How can meta boxes be added to “unknown” custom posts?

I’m not sure what you mean by “unknown custom posts”, but here is how you’d add a meta box to a number of post types: $post_types = array( ‘post’, ‘page’, ‘my_custom_post_type’, ); foreach ($post_types as $post_type) add_meta_box(‘Intro’, __(‘Intro’), ‘my_meta_box’, $post_type, ‘normal’, ‘high’); If you would like to have different contexts and/or priorities, you have to … Read more

Targeting custom post type

You can make use of get_post_type( $post ) to check whether a post belongs to a certain post type Inside your loop, you can do the following check while ($my_query->have_posts()) : $my_query->the_post(); if ( ‘activists’ == get_post_type() ) { /* Custom code for ‘activists’ post type. */ } else { /* Custom code for the … Read more

Why does not this wp_redirect work in is_single()?

is_singular() only accept post_type, use is_single(‘2024’) for specific post. if (is_single(2024)) { wp_redirect(‘http://mysitedomain.com/../rugby/’); exit(); } Update: Also wp_redirect() does not work after headers are sent. Please make sure you are redirecting before headers. So you can hook this function on template_redirect and put this in functions.php function redirect_custom_page() { if (is_single(‘2024’)) { wp_redirect(‘http://mysitedomain.com/../rugby/’); exit(); } … Read more