Remove an action added within a class in a WordPress plugin

I finally managed to make it work : function remove_searchfield() { $tag = ‘epl_frontend_search_field_select’; // the name of the hook $function = ‘render_select’; // the function you wish to remove $priority = 10; // must be an integer remove_action ( $tag, array( Easy_Property_Listings::instance()->search_fields, $function ), $priority); } add_action( ‘init’, ‘remove_searchfield’); Thanks Jacob for the help … Read more

Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?

WordPress redirects you back to the user-edit.php page upon successful user update, so while the admin_notices has yet been fired in your sulock_save_profile_fields(), the message (your custom admin notice) is never displayed because of the redirection. And one way to fix it, is by filtering the redirect URL via the wp_redirect filter: // In sulock_save_profile_fields() … Read more

Run a function on all posts

Rather than hooking into init or wp_load, here is a snippet you can drop into functions.php or on a theme file. I put it behind a $_GET so that you can only hit it once and when you are ready. Something like https://domain.com/page/?update_post_meta // Hide it from the public if(isset($_GET[‘update_post_meta’])){ // Let’s query all of … Read more

WooCommerce: after install hook

WooCommerce itself isn’t setting fresh_site to 0 directly (the string fresh_site doesn’t appear anywhere in WooCommerce’s source code), however you are correct that it’s happening because WooCommerce is creating pages. WordPress sets a site to not be fresh like this (from wp-includes/default-filters.php): // Mark site as no longer fresh foreach ( array( ‘publish_post’, ‘publish_page’, ‘wp_ajax_save-widget’, … Read more

W3TC manual cache flush does not work

The working solution is: <?php /* * Flushing the W3TC Plugin’s Cache entirely * @package WordPress */ ignore_user_abort( true ); include(‘/home/clients/<client-directory>/<website-directory>’ . ‘/wp-load.php’); w3tc_flush_all();

why require – does not load filter

The filter itself probably works, but the file_exists() returns false. So not sure if this answers the question, but one issue I see in your code is: When you put the code in your-plugin/admin/partials/ggowl_template/ggowl_template_func.php, plugin_dir_path( __FILE__ ) from within the ggowl_template_post_function() would be your-plugin/admin/partials/ggowl_template/ — and not the main plugin file path, so I suggest … Read more