Metabox with checkbox is not updating

Here is code I have used before – the main difference looks to me that you are checking if the meta exists rather than what it’s value is to determine if it should be checked. // Checkbox Meta add_action(“admin_init”, “checkbox_init”); function checkbox_init(){ add_meta_box(“checkbox”, “Checkbox”, “checkbox”, “post”, “normal”, “high”); } function checkbox(){ global $post; $custom = … Read more

Does WordPress have a “Form API”?

No, but it should 😉 There are several custom field class’s (backend). wpAlchemy : https://github.com/farinspace/wpalchemy Meta Box Script: https://github.com/rilwis/meta-box My-Meta-Box: https://github.com/bainternet/My-Meta-Box meta-box-class: https://github.com/corycrowley/meta-box-class Meta Boxes Class: https://github.com/Bakke/Wordpress-Custom-Meta-Boxes-Class For front-end forms, you probably best off with a plugin in Eugene Manuilov’s link.

Trigger Javascript on Gutenberg (Block Editor) Save

Not sure if there is a better way, but I am listening to subscribe rather than adding an event listener to the button: wp.data.subscribe(function () { var isSavingPost = wp.data.select(‘core/editor’).isSavingPost(); var isAutosavingPost = wp.data.select(‘core/editor’).isAutosavingPost(); if (isSavingPost && !isAutosavingPost) { // Here goes your AJAX code …… } }) Official docs of the Post Editor data: … Read more

Is there an easy way to make a meta box have the tabs like the Categories meta box has?

Here’s a very basic example.. /* Code assumes it will be in the theme functions.php file Update the enqueue path if using it elsewhere */ add_action( ‘add_meta_boxes_post’, ‘add_post_metabox’ ); function add_post_metabox() { wp_enqueue_script( ‘mytabs’, get_bloginfo( ‘stylesheet_directory’ ). ‘/mytabs.js’, array( ‘jquery-ui-tabs’ ) ); add_meta_box( ‘examplebox’ , __(‘Example box’), ‘my_example_metabox’, ‘post’, ‘side’, ‘core’/*,array()*/); } function my_example_metabox() { … Read more

How to change default position of WP meta boxes?

You can remove the default meta boxes with remove_meta_box and re-add them in a different position with add_meta_box: add_action(‘do_meta_boxes’, ‘wpse33063_move_meta_box’); function wpse33063_move_meta_box(){ remove_meta_box( ‘postimagediv’, ‘post’, ‘side’ ); add_meta_box(‘postimagediv’, __(‘Featured Image’), ‘post_thumbnail_meta_box’, ‘post’, ‘normal’, ‘high’); } This will remove it from the side column and add it to the main column. change post in this example … Read more

Add a Meta Box for uploading a SECOND Featured Image?

The functionality you want may be built from scratch but definitely a custom fields plugin will make your life much easier. I use Advanced Custom Fields, and it gives amazing results and the possibilities are endless. I haven’t used this one, but it seems pretty good too.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)