Tag Info

Hot answers tagged


$post_types is undefined inside your function, add_meta_box checks if the value is null and defaults to the current post type when the action runs. That's why it appears to work when $post_types = get_post_types(); is outside, when in reality it's doing nothing. It doesn't work when you add $post_types = get_post_types(); inside the function, because that ...


I looks like you are using the custom meta boxes and fields github repo, which is an awesome library. I think the primary thing you need to do is a new WP_Query. Below is an example of that in action. The only difference is that in my example I made the "Assign to Homepage" a checkbox on the custom post type. <?php $args = array( 'post_type' => ...

Only top voted, non community-wiki answers of a minimum length are eligible