How to show taxonomy terms from wordpress database?

Solution One: get_terms() – Retrieve the terms in a given taxonomy or list of taxonomies. You can fully inject any customizations to the query before it is sent, as well as control the output with a filter. The ‘get_terms’ filter will be called when the cache has the term and will pass the found term … Read more

How to check specific value in two metabox?

You need to add the meta_compare argument to the meta query . Now your code will be like : ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘pb_responsible_home_person’, ‘value’ => $current_player_name, ‘compare’ => ‘=’ ), array( ‘key’ => ‘pb_responsible_away_person’, ‘value’ => $current_player_name, ‘compare’ => ‘=’ ), )// meta query end EDIT $current_player_name = get_post_meta( … Read more

How to add meta box for current post format?

If you want it just for the native post post type, then put this in your functions.php add_action(‘init’, ‘my_theme_setup’); function my_theme_setup(){ add_theme_support( ‘post-formats’, array( ‘aside’, ‘gallery’ ) ); } The Post Format meta box will now appear down the side of your screen on the post creating/editing page. Full list of available post formats to … Read more

Meta box does not save or update

The reason that the field is not saving is due to the nonce check in my_content_save() failing. Changing the nonce check to the following code will fix the issue: if (!wp_verify_nonce( $_POST[‘content_overview_nonce’], ‘content_overview_save’ )){ return; } The nonce check should use the content_overview_save action because that is what was specified here: wp_nonce_field( ‘content_overview_save’, ‘content_overview_nonce’); Note … Read more

Cannot remove meta box added through OOP

Well, the function remove_meta_box is meant to handle only the UI part, it only removes the metabox from the screen. If you want to also delete the post metadata for that specific key you will need to use delete_post_meta function.

edit_page or edit-pages for current_user_can()?

You can find list of capabilities here: Roles and Capabilities There is no capability called edit_post nor edit_page. But… There is also something called Meta Capabilities. The capabilities listed on the Capabilities list are global capabilities. So they’re saying that user can edit posts or pages. But it doesn’t mean that given user can edit … Read more