• compassioniseverything

    (@compassioniseverything)


    I am listing the majority of my recent posts in the sidebar for easy access. There are some posts I DO NOT want listed (as they are listed in both categories and the primary menu up top). I went into the widget, selected “Visibility” I chose HIDE if then Category, then Light A Candle, I also added if tag was “candle”. I clicked save and done.

    But when you look at the Recent Posts in the right hand column, the two posts I asked to be hidden are still there. I tried several times, even cleared my history and went back in.

    Those type of posts do not need to be under recent posts. This should have worked. Why didnt it? Did I miss a step? (and yes, it does need to be a post as opposed to a page as the people that subscribe to the blog need to see these each day).

    Thank you for your time and assistance

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator t-p

    (@t-p)

    try pasting this into your theme’s functions.php, change the post ID:

    add_filter( 'widget_posts_args', 'exclude_posts_wpse_103570');
    
    function exclude_posts_wpse_103570( $args ){
        // post ID's to exclude:
        $args['post__not_in'] = array( 123 );
        return $args;
    }
    • This reply was modified 6 years, 7 months ago by t-p.
    • This reply was modified 6 years, 7 months ago by t-p.
    Thread Starter compassioniseverything

    (@compassioniseverything)

    I added as directed but when I refreshed my website, April 1, 2018 and April 2, 2018 in Recent Posts was still there. I posted the code at the bottom, was that ok?

    Thread Starter compassioniseverything

    (@compassioniseverything)

    If “Hide” would offer a selection of POST it would be easy just to add in the number of the post. But the drop down does not offer post……only page, category, editor, author, etc.

    Moderator t-p

    (@t-p)

    1). did you update the code with your actual post ID that you want hiding?

    2). Have you tried Flushing any caching plugins you might be running, as well as server and/or browser caches. Not just your browser, but any op cache or content network cache as well such as Cloudflare.

    Also, flushing Managed host caches. Managed WP hosting often has special caches. If your host has a “Purge Varnish” or “Flush Memcache” tool, try that. You can ask your provider to flush memcache and Varnish for you if necessary.

    • This reply was modified 6 years, 7 months ago by t-p.
    Thread Starter compassioniseverything

    (@compassioniseverything)

    Update the code…..i did not. What part would I update? Sorry, I am code NOT savvy ?? just point out the areas I need to change and I will do that.

    no plugin caches, no WP hosting, autopurge cache’s on Fridays, clean out browser history and such every night. CLeaned out hosting cache as well. I just put up this website last friday so still working out the kinks. Thank you for your help!

    Thread Starter compassioniseverything

    (@compassioniseverything)

    oh, i see, post id’s to exclude, I need to add in the number of the post, yes?

    This is going to be a once a day posting so can I put like post 1307-2307? or will have i have add the post and update the code, daily? that is going to be ALOT of numbers ??

    Moderator t-p

    (@t-p)

    Post ID

    Thread Starter compassioniseverything

    (@compassioniseverything)

    thanks, i will try that ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hiding Specific Recent Posts in Recent Post Widget’ is closed to new replies.