Hooks not working on live server

get_footer hook fires before the footer template file is loaded. Note: This hook is best to use to set up and execute code that doesn’t get echoed to the browser until later in the page load. Anything you echo will show up before any of the markup is displayed. Besides, make sure you call the … Read more

Hook automatic_updates_complete to autoupdate plugin

I found a solution: function my_function_to_run_on_autoupdate(array $results ): void { // Iterate through the plugins being updated and check if ours is there. foreach ( $results[‘plugin’] as $plugin ) { if ( isset( $plugin->item->slug ) && strlen( $plugin->item->slug ) > 0 // ‘your-plugin-slug’ is usually the folder name of your plugin && $plugin->item->slug === ‘your-plugin-slug’ … Read more

Using “add_image_size” to register custom image sizes inside plugins not working

There’s several misunderstandings about how WordPress works here. I noticed that most examples of add_image_size() is done via the after_setup_theme hook. Which means, for it to register, one has to switch theme and reactivate the theme. Firstly, that’s not what it means. The after_setup_theme hook runs on every page load after the theme has been … Read more

image_size with respect to aspect ratios

Right before image subsizes are created, there’s a filter called intermediate_image_sizes_advanced that lets you modify the list of sizes. Here’s code that you could expand on — right now it just removes the thumbnail as a proof of concept: function remove_image_sizes_before_generation( $new_sizes, $image_meta, $attachment_id ) { $width = $image_meta[0]; $height = $image_meta[1]; // … Calculate aspect … Read more

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