Best place to load wp_ajax_the_ajax_hook action in plugin

I don’t know if it is the ‘best’ place, but get_header is early enough to still enqueue scripts: function at_set_header () { global $post, $has_the shortcode; if ( is_object( $post ) && has_shortcode( $post->post_content, ‘shortcode_name’) ) { $has_the_shortcode = true; wp_enqueue_script( ‘my-ajax-handle’, FAU_PLUGIN_URL . ‘js/ajax.js’, array( ‘jquery’ ) ); wp_localize_script( ‘my-ajax-handle’, ‘the_ajax_script’, array( ‘ajaxurl’ => … Read more

How to Get WordPress custom post data in WooCommerce product meta panel? [closed]

My answer use 3 steps too : Step 1 : adding a new tab on the list add_filter(“woocommerce_product_data_tabs”, function ($product_data_tabs) { $product_data_tabs[“newTabId”] = [ “label” => “Hello 1”, “target” => “htmlIdOfTheBox”, “class” => [], ]; return $product_data_tabs; }); Step 2 : preparing the html box for this new tab add_action(“woocommerce_product_data_panels”, function () { ?> <div … Read more

Modal suddenly disapearring [closed]

Your code looks good. You may have some more JavaScript code that is making some confict. Try changing the parameters id In the button data-target=”#myModal” to data-target=”#myModal-custom” And the modal window id=”myModal” to id=”myModal-custom” Please read the official documentation of Bootstrap.

Include comments form in plugin page

Just as @Jevuska mentioned, you can use the $post_id as an argument here, in fact, you can also use a ton of optional $args as well <?php comment_form( $args, $post_id ); ?> You can find the information in the Codex here: https://codex.wordpress.org/Function_Reference/comment_form