Show how many images are attached to a post/page on compose page

add_action( ‘add_meta_boxes’, ‘attached_images_meta’ ); function attached_images_meta() { $screens = array( ‘post’, ‘page’ ); //add more in here as you see fit foreach ($screens as $screen) { add_meta_box( ‘attached_images_meta_box’, //this is the id of the box ‘Attached Images’, //this is the title ‘attached_images_meta_box’, //the callback $screen, //the post type ‘side’ //the placement ); } } function … Read more

Convert textarea with wp_editor

This is was I use to convert textarea with wp_editor() wp_editor($value, “editor-name”, array( ‘tinymce’ => array( ‘theme_advanced_buttons1’ => ‘bold,italic,underline’, ‘theme_advanced_buttons2’ => ”, ‘theme_advanced_buttons3’ => ” ) ));

add wp_editor to custom_meta_box

To use wp_editor() you’ll need to replace your textarea tag with the output from wp_editor() like so: case ‘textarea’: wp_editor($meta, $field[‘id’]); echo ‘<br /><span class=”description”>’.$field[‘desc’].'</span>’; break; You don’t need to echo wp_editor() since it does it automatically. You can pass an array of settings as a 3rd argument to configure it’s behaviour. More info here: … Read more

Display meta box on front end

Use this code $schema_group = rwmb_meta( ‘schema_group’ ); $schema_knvb = isset( $schema_group[‘schema_knvb’] ) ? $schema_group[‘schema_knvb’] : ”; echo $schema_knvb; for more detail check the “Meta Box Group” page on the plugin documentation https://metabox.io/docs/meta-box-group/#section-how-to-get-meta-value-of-a-sub-field

Undefined ‘post_type’ error on Add new page

save_post is called when post is inserted or updated. When you access add new post a post is created and inserted into database. That is actually draft. At that time $_POST is blank therefore, you are seeing warnings. Solution: The best option is exit the function as soon as you don’t find the nonce. And … Read more

Having trouble getting my meta data to save

in nffa_save_meta_box_tags(), you use $mtags, but $mtags is not defined in that function. Manually replacing the two instances of $mtags[‘id’] with ‘NFFA_meta_tags’ makes the value save – showing that’s part of the problem. The other problem is that santize_text_field() has a typo, should be sanitize_text_field().

Change Metabox Title

The “Right way” to do this is hooking to the ‘add_meta_boxes’ action, like so: add_action(‘add_meta_boxes’, ‘my_metabox_titles’, 10, 2); function my_metabox_titles($post_type, $post) { global $wp_meta_boxes; // array of defined metaboxes // cycle through the array, change the titles you want }