How to Use Custom Meta Field Instead of CPT Title in Post URL

You have to use a wp_update_post function and update the required fields based on available fields in WP_Post class. add_action( ‘save_post’, ‘wpse75679_save_post’ ); function wpse75679_save_post( $post_id ) { if( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; // verify post is not a revision if ( ! wp_is_post_revision( $post_id ) ) { // unhook this function … Read more

Starting with tabbed metabox

First, you have to create the metabox. Then you have to add tabs to the metabox. For the first step, to create a metabox, here is a tutorial for you. You can use that as bases for your metabox, and maybe modify it according to your needs. For the second step, you have to add … Read more

Get id from metabox dropdown

the_meta is a very bare-bones method. The return value you’re seeing is raw, unserialized data. WordPress uses PHP serialization to store complex values like Arrays and Objects as a string value. Have a look at get_post_meta: $guest_id = get_post_meta( get_the_ID(), ‘episode_guestid’, true ); $guest_post = get_post( $guest_id[0] ); echo ‘<pre>’; print_r( $guest_post ); You should … Read more

How to use Gutenberg in CMB2?

This is, at least at the moment, not possible. You can use CMB2 Meta Boxes in Gutenberg Post Types, but you can not make a CMB2 Field where you can use Gutenberg – as of now. However, as the Gutenberg Editor is developed further, a CMB2 Block-Editor-Field is not that far. As of now, you … Read more

WordPress Featured Image meta box not showing

You might be facing this problem because your theme does not support featured images. But you can easily add that support, so no worries 🙂 To quote the WordPress Theme Handbook: Themes must declare support for the Featured Image function before the Featured Image interface will appear on the Edit screen. Support is declared by … Read more

Access post title from custom meta box on title change

The event listener you have added will only attach to the available .editor-post-title__input elements, and won’t attach to any dynamically added elements. You are better to move the listener to the body as follows: jQuery(‘body’).on(‘keyup’, ‘.editor-post-title__input’, function(event){ console.log(jQuery(this).val()); }); Given the admin area is moving to use more React components, it’s a good habit to … Read more