Tag Info

Hot answers tagged


The get_post_type_object() function accepts a post type name and returns the post type object. You can then check the capability_type property of this object. Example: $post = get_post( $post_id ); $pto = get_post_type_object( $post->post_type ); $cap_type = $pto->capability_type;


All thanks to @PieterGoosen's comment, I figured out that this issue was due to a setting within the WPML (multilingual) plugin. Under the 'translation management'->'multilingual content setup' tab of the plugin settings, there is a section for 'custom posts'. In this section, my 'publications' post type was not set for translation, and this somehow ...


My problem was solved with this link. It was very helpful and difficult to find. function add_custom_query_var( $vars ){ $vars[] = "brand_name"; return $vars; } add_filter( 'query_vars', 'add_custom_query_var' ); function add_rewrite_rules($aRules) { $aNewRules = array('brand/([^/]+)/?$' => 'index.php?pagename=hotel&brand_name=$matches[1]'); ...


Use the following before $post->ID in your code: global $post

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