Action hook ‘wp’ firing twice… why?

It can happen if one of the files you include in the theme is returning 404 Not Found error. Like, if you’re linking to a .js or .css or an image which does not exist on that location. Use the Inspector in your browser to see if you get any 404 errors, anywhere. Fix them … Read more

How to customize the WP admin default help contents

Files to look at: wp-admin/includes/wp-current-screen.php and wp-admin/admin-header.php If we take a look at admin-header.php we can see that $current_screen->render_screen_meta(); is the one responsible for rendering the contextual help on screens. It gets the global $current_screen which is set via WP_Screen class. It has methods like get_help_tabs,get_help_tab,add_help_tab,remove_help_tab,remove_help_tabs , set_help_sidebar which sets and removes the tabs we … Read more

Admin Notification after save_post, when ajax saving in gutenberg

Presenting Notices Gutenberg provides a mechanism for displaying notices in the form of the Notices Data package. In Gutenberg’s editors, the package’s selectors and action creators are exposed on the core/notices store, and can be accessed by any standard means therein, e.g.: useDispatch( ‘core/notices’ ) hook in functional components (including the edit() function of a … Read more

How to create thumbnails for PDF uploads?

If I’m not totally mistaken, the code you have given on your update won’t work, because the file/mime type pdf isn’t supported by the WP_image_editor class called by wp_get_image_editor(). Creating a thumbnail from a uploaded pdf file can be achieved though. Below code gives you a insight in a possibility how to do it, I … Read more

Filter out results from REST API

If you’re using WP 4.7+ you can filter the query using the rest_$type_query hook wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:L267 This is a working example that filters current query by given terms $types = [ ‘post’, ‘page’, ]; foreach ( $types as $type ) { add_filter( ‘rest_’ . $type . ‘_query’, ‘filter_rest_query_by_zone’, 10, 2 ); } function filter_rest_query_by_zone( $args, $request … Read more

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