Add filter conditionally to a page
Add filter conditionally to a page
Add filter conditionally to a page
Add HTML to the bottom of each post in a post list
the_content filter not working when Jetpack activated. Any idea?
from How can I change HTTP headers only to posts of a specific category from a plugin: add_action( ‘template_redirect’, ‘update_header_cache’ ); function update_header_cache() { if( is_single( 1234) ) { header(‘Cache-Control: no-store, no-cache, must-revalidate, max-age=0’); header(‘Pragma: no-cache’); header(‘Expires: Thu, 01 Dec 1990 16:00:00 GMT’); } }
function rpf_add_query_var_not_to_show_user_request_product($query) { $post_type = $query->get( ‘post_type’ ); if ( ! is_null($post_type) && $post_type == ‘product’ ) { $query->set( ‘meta_key’, ‘_user_request’ ); $query->set( ‘meta_value’, ‘no’ ); $query->set( ‘meta_compare’, ‘=’ ); // default } } add_action( ‘pre_get_posts’, ‘rpf_add_query_var_not_to_show_user_request_product’, 100, 1 ); yes, pre_get_posts is heaven! and $query->set(), $query->get() are angels!
WP Dashboard -> Posts-> Filter > BUG!
Adding filter to an specific page/site direction
Pagination while keeping the filters
If you are using the API to respond with one or more categories, you are querying for terms and not for taxonomies. So you should not be using WP_REST_Taxonomies_Controller but rather WP_REST_Terms_Controller. Instead of hooking to the filter rest_prepare_taxonomy, try hooking to rest_prepare_{$this->taxonomy} instead. As you are working with the taxonomy “category” use it as … Read more
Note that the wp_mail filter runs before the wp_mail_content_type filter. If you’re using the PHP Mailer then you can try (untested): add_action( ‘phpmailer_init’, function( $phpmailer ) { if( ‘text/plain’ === $phpmailer->ContentType ) { $phpmailer->Body = ‘Filtered text here’; // <– Message override } });