Adding link options in insert/edit link dialog window
Adding link options in insert/edit link dialog window
Adding link options in insert/edit link dialog window
do_action in API call
You can add the action on the init itself, just increase the priority of the add_action call. The higher the priority the later the function is called. add_action(‘init’, ‘retrieve_my_terms’, 9999); But my suggestion is that you should do these kind of things as late as possible, preferably just before the first time they are used. … Read more
I tested your code and it seems to work fine, my guess is that your $targetHanldes containes the wrong handles. Best option would be to see what $html and $handle contain and that way you could add them to the haystack. But for now try this instead $targetHanldes = array(‘flexible-shipping-notices’, ‘animate’); Again this is pure … Read more
You can do something like this. add_action(‘publish_page’, ‘bt_publish_post’, 10, 2); function bt_publish_post ($post_id, $post) { // our bt_page_status codes will indicate one of three thing // if empty than we know that page is published // if 1 we know that page was updated for the first time // if 2 we know that page … Read more
I found a solution: function myAction() { if(defined(“REST_REQUEST”) && REST_REQUEST) { return; } // Do action stuff } The request to /wp-json/wp/v2/pages/1373 is a request to the API which defines the constant REST_REQUEST and sets it to true. If anyone’s got an idea why an extra API request is sent, please feel free to add … Read more
First you need to edit your searchform.php file. If you are using get_search_form(); read this . In case you use search widget you need to override the Widget. If you dont want to use searchform.php you can go with filter: function wpdocs_my_search_form( $form ) { $form = ‘<form role=”search” method=”get” id=”searchform” class=”searchform” action=”‘ . home_url( … Read more
Add metabox if there is at least one post available
I’m not sure if my use of globals is correct. I would prefer this method as it seems simplest. It’s not. The problem is that wp_handle_upload_prefilter is occurring in a completely separate AJAX request. It has no access to any PHP variables (global or otherwise) defined on user-edit.php. If you hard-code the value into the … Read more
Problem solved! add_action(‘init’, function () { $object = \GF_User_Registration::get_instance(); remove_action(‘wp’, [$object, ‘maybe_activate_user’]); }, 20); Thanks SallyCJ for the tips!