Revision: 64170
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 11, 2013 06:28 by jonasethomsen
Initial Code
function is_custom_post_type() { global $wp_query; $post_types = get_post_types(array('public' => true,'_builtin' => false),'names','and'); foreach ($post_types as $post_type ) { if (get_post_type($post_type->ID) == get_post_type($wp_query->post->ID)) { return true; } else { return false; } } }
Initial URL
Initial Description
Check if current post type is a custom post type – WordPress. Returns a true/false-statement. Can be used outside The Loop.
Initial Title
Check if current post type is a custom post type – WordPress
Initial Tags
php, post, wordpress
Initial Language
PHP