Disable WooCommerce action
That would be: remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’, 5 ); You can read about it here: remove_action Codex
That would be: remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’, 5 ); You can read about it here: remove_action Codex
Yes, delete_expired_transients is a cron event that runs once per day and the function delete_expired_transients() is automatically called when the cron event runs — see wp-includes/default-filters.php. So you do not need to call the function manually like you did in your my_custom_fn() function. And if you use a plugin like WP Crontrol, you can easily … Read more
You can do this: class testclass { function test() { echo ‘howdy’; } } add_action(‘wp_head’,array(‘testclass’,’test’)); Or this: $t = new testclass(); add_action(‘wp_head’,array($t,’test’)); It doesn’t work like… $t = new testclass(); add_action(‘wp_head’,’t’); // or this either, for good measure $t = new testclass(); add_action(‘wp_head’,array(‘t’)); .. but I am not sure what you are trying to accomplish … Read more
Maybe I got you wrong, but why don’t you just put the following line in your functions.php: remove_action(‘eazyest_gallery_thumbnails’, ‘ezg_thumbnails’); If you have a class function hooked to an action, you can use the class name instead of the class object: remove_action( ‘eazyest_gallery_thumbnails’, array(‘EazyestFrontendClassName’, ‘ezg_thumbnails’) ); Right now, I don’t see why this wouldn’t be working. … Read more
the_content is also a filter, into which the content is passed as an argument. You simply prepend your content and then return like so. add_filter(‘the_content’,’prepend_this’); function prepend_this($content) { $content = “string to prepend” . $content; return $content }
I was working with wp_cron last week in a plugin and we have a fight and are no longer on speaking terms, but for reference this is what I do; 1) – set the scheduled cron event on register_activation_hook 2) – remove the scheduled cron event on register_deactivation_hook If you are concerned that your scheduled … Read more
For … do_action(‘admin_enqueue_scripts’, $hook_suffix); … the callback gets the hook suffix as first parameter. Since it is an action you don’t have to return anything. You can use it in a rather flexible callback function: add_action(‘admin_enqueue_scripts’, ‘wpse_49993_admin_script_callback’ ); function wpse_49993_admin_script_callback( $hook_suffix ) { switch ( $hook_suffix ) { case ‘index.php’: // dashboard // do one … Read more
In a WordPress footer hooks are different for back-end(dashboard) and front-end. In Dashboard use “admin_footer” hook. In Front-end use “wp_footer” hook.
Looking at the WordPress source code, I’d say that wp_ajax_nopriv_* fires only if you’re not logged in, and wp_ajax_* fires otherwise. Here’s the relevant bit, in admin-ajax.php, lines 85-115 in version 5.0.3: if ( is_user_logged_in() ) { // If no action is registered, return a Bad Request response. if ( ! has_action( ‘wp_ajax_’ . $_REQUEST[‘action’] … Read more
You kind of answered the question yourself already, Create a function that will create the 3 posts ex: function create_new_user_posts($user_id){ if (!$user_id>0) return; //here we know the user has been created so to create //3 posts we call wp_insert_post 3 times. // Create post object $my_bio_post = array( ‘post_title’ => ‘bio’, ‘post_content’ => ‘This is … Read more