Automatically add to category
-
Hey Guys.
My goal here is to do a kind of “catch all”, where if a post meets certain criteria, it would be put in a specific category automatically. For example, if the post has a Youtube Video, it would automatically be put into the (pre-existing) category, “Videos”.
<?php $youTubeVideo = get_post_meta($post->ID, 'Youtube Video', true); if (file($youTubeVideo) && !in_category('33387')) { // It has the Youtube meta but it's not in Videos.. so put it in Videos. } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Automatically add to category’ is closed to new replies.