the_post hook called more than once in single post
-
im looking to insert a list of categories in a div tag before each post, whether on a multiple page (like front page) or once in a single post.
works fine for multiple posts but for the single posts, the action is called more than once. such that content appears in the header. which is very odd.
add_action( ‘the_post’, ‘add_stuff’);
function add_stuff() {
$categories = get_the_category();
format the categories in a list.
echo ‘<div> list </div>’;
}it happens in some themes, but not others. Thematic pushed out this error. others dont.
is there a function that perhaps qualifies the state
in_the_loop or in_header or the like.
sadly, in_the_loop doesnt add any stateful information that the_loop doesnt.
- The topic ‘the_post hook called more than once in single post’ is closed to new replies.