WordPress scheduled task is called but not executed

I was having the same issue recently, until I followed an example from the WordPress Codex which suggests using action hooks to run the function. I think if you add the following… add_action( ‘recalculate_all_scores_hook’, ‘recalculate_all_scores’ ); …and amend the wp_schedule_event function to use the action hook name rather than the function directly… wp_schedule_event( time(), ‘fiveminutes’, … Read more

Featured image upload finished hook

There is a deault feature available on WP to crop image once you upload. You can edit the image you upload and can crop image with you preferences. How to crop rotate scale and flip images in wordpress WordPress by default is designed to generate 3 types of cropping of any uploaded images (Media) automatically … Read more

WordPress admin notice in plugin function

Your problem is pretty simple. Your callback for this hook is not a simple function but some method of a class. If you add action like this: add_action(‘admin_notices’, ‘simple_notice’); you tell WP that there is some simple function called simple_notice and it should be called when hook admin_notices is processed. But… There is no such … Read more

Overriding The Loop with filter or hook

This seems to work, but I would be interested in hearing from others if it’s the “correct” way to provide this sort of override. I’m assuming you’re visiting a category archive page, like http://www.example.com/category/computers/. // landing page = 188 // category = “computers” (#8) function custom_wpquery( $query ){ // the main query global $wp_the_query; if … Read more

Extending WP_User class and using this sub-class during the whole lifecycle

If I did understand well, we need to cache a value retrieved from another REST service, from the login to logout of the user on the wordpress installation, so we will hook into this wp_login to get the value and cache it using Transient API, Options API or a persistent caching plugin. add_action(‘wp_login’, ‘my_get_and_cache_rest_value’); function … Read more

Hide gutenberg option blocks

Some of the panels related to the entire post (e.g. the featured image, excerpt) can be removed and https://github.com/WordPress/gutenberg/issues/17281 shows how. e.g. wp.data.dispatch( ‘core/edit-post’).removeEditorPanel( ‘featured-image’ ); wp.data.dispatch( ‘core/edit-post’).removeEditorPanel( ‘post-excerpt’ ); The sidebar is also used for additional block options and there’s currently no cohesive, consistent way to manage whether a block’s options are available to … Read more

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