Tag Info

New answers tagged


The first problem is that $post is not in scope in your callback. You need to alter the code to pull that in: function only_one_agenda_featured( $post_id, $post ) { // ... } add_action( 'save_post', 'only_one_agenda_featured' ,10, 2); Given that change, things should work better, but the code is overly complicated. Unless you need a history of old ...


I want this condition to only be applied to one post, i.e. when the user declares a post as "featured", and saves it, all the other ones (theoretically only the last one) that have this meta value checked, should be turned "off". You might then try to save the one and only featured post ID as an option instead. Then you don't need to pollute the ...

Top 50 recent answers are included