How to filter posts in admin by before date or by post status ‘future’?

The question pretty much got covered in another thread here. In case anyone else need anything like this I ended up using following code to hide all the posts that are over a week in the future. function hide_future_posts($where, $q) { if(is_admin() && $q->is_main_query() && !filter_input(INPUT_GET, ‘post_status’) && ( $screen = get_current_screen() ) instanceof \WP_Screen … Read more

How do I add a class to all sidebars to let a Google Custom Search Engine know not to index the content?

If you want to add a class before each widget you should use the dynamic_sidebar_params filter. Another post explains this well. Here’s the gist of it. function uft_add_nocontent_class($params) { $params[0][‘before_widget’] = ‘<aside id=”%1$s” class=”widget %2$s nocontent”>’; return $params; } add_filter(‘dynamic_sidebar_params’, ‘uft_add_nocontent_class’); Otherwise, go and edit your child theme files. If you don’t have a lot … Read more

posts_results filter function memory errors

Sorry folks – for those curious, I had already solved this later on in my functions.php file and forgot to turn this filter off (silly). Here’s the better solution if anyone cares to comment or improve. Basically, I’m filtering out content based on user role (I have a custom user role as well) so that … Read more

Change shortcode output (filter?)

I was able to solve this by using str_replace. function mp_filter_download( $result ) { $search=”<div style=”clear:both;”></div>”; $replacewith=” “; return str_replace( $search, $replacewith, $result ); } add_filter( ‘downloads_shortcode’, ‘mp_filter_download’, 10, 2 );