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

MetaBox not saving after empty

Here’s an updated version of save_TFP_meta(), which has modified saving logic. It fixes the issue where the meta data was not being saved after being emptied. function save_TFP_meta( $post_id, $post ) { if ( ! wp_verify_nonce( $_POST[‘TFP_meta_box_nonce’], plugin_basename( __FILE__ ) ) ) return $post_id; if ( ! current_user_can( ‘edit_post’, $post_id ) ) return $post_id; $TFP_meta_value … 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

Using WP Color Picker in Repeatable Fields

It’s hard to know for sure, since you don’t include the markup you’re output for the metabox nor the JS you’re using to clone. But, the following simplified setup seems to work for me: metabox markup <label for=”my_field”> My Color Picker Field </label> <input name=”my_field” id=’my_field’ type=”text” class=”my-colorpicker” /> <a href=”#” class=”clone-it”>Add Another Color Picker</a> … Read more

Custom posttype content metabox

I think you may be in a recursive loop. if you hooked into save_post that will be triggered again when you call wp_update_post. you can temporarily remove the hook. Not knowing exactly how you have written the hook the below code is a guess. remove_action( ‘save_post’, [ $this, ‘saveModel’] ); wp_update_post([ ‘ID’ => $postId, ‘post_content’ … 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