Hot answers tagged

1

Your premise is correct - you can connect to different STMP accounts based on whatever criteria you can build into your action function. It's a little tricky with WooCommerce because it has two email objects that it uses, one for creating emails and the other for sending. Also, hooking into the WC send process requires some serious grokking of WC to figure ...


1

Untested but can you do: add_action('pre_get_posts', 'change_post_order'); function change_post_order($query){ if($query->is_tax('series')) { $query->set('order','ASC'); $query->set('orderby','date'); } } Based of this and this.


1

As you are using the default commenting feature for commenting, you can do all on your own. A rough idea on how to do that could be like below: Step 1: Create Form and Display Create your own form and enqueue on your post template // Clear up the alert parameters. $_SERVER['REQUEST_URI'] = remove_query_arg( 'success', $_SERVER['REQUEST_URI'] ); <form ...


1

I found the solution. addFilter( 'blocks.registerBlockType ) needs to be called before the call to registerBlockType.


1

If you prefer more control in coding, you may use request hook - test the WordPress query after it is being setup preg_match() - match /product/ keyword url_to_postid() - test if product url exists to build a checking when WordPress query is being setup. The advantage of code against .htaccess is that it is relatively server independent such as server ...


1

What about filtering the_content? function se365701_require_email ( $content ) { if ( is_page( 'require_email' ) ) && !isset( htmlspecialchars( $_COOKIE['submitted_email']) ) { return $form; // your MailChimp Form Code } else{ return $content; } add_filter( 'the_content', 'se365701_require_email' ); Note that your form provide ...


1

You might want to add your own plugin to deactivate their plugin (silently). First open their main plugin file and see where the plugin hooks (or filters) in. Then unhook their plugin … and your's as well. <?php /** Plugin Name: Deactivate other plugin */ add_action( 'the_same_hook', 'removeOtherPlugin', PHP_INT_MAX -1 ); function removeOtherPlugin() { ...


1

This is similar to the @birgire's answer, but it provides a nice report that can be displayed for any URL in a WordPress site. You'll need to be logged-in as an Admin level user, then add ?wp-hooks onto the end of a URL you want to test. /** * WordPress Hooks Reference * * Dump all action and filter hooks at the bottom of any page * by adding ?wp-hooks onto ...


1

As mentioned on other answers, passing a parameter to the callback function is not possible by default. OOP and PHP anonymous function are workarounds BUT: Your code might not be OOP You might need to remove that filter afterwards If that is your case, there is another workaround for you to use: make yourself use of the add_filter and apply_filters ...


Only top voted, non community-wiki answers of a minimum length are eligible