Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Little more info. The title, number, and exclude data are being store in the database in the *yourprefix*_options table. Do you have access to your database via phpMyAdmin or something similar?

    There is a field in the ‘option_name’ column called ‘widget_recent-posts’, that stores the values in an array that looks similar to this:

    a:2:{i:2;a:3:{s:5:”title”;s:0:””;s:6:”number”;i:5;s:7:”exclude”;s:1:”1″;}s:12:”_multiwidget”;i:1;}

    So caching shouldn’t affect that. It’s persisted in the database.

    Widgets are weird little creatures and I’ve never fully understood them. I’ve run into similar issues in the past, usually when migrating sites where I’d lose all Widget data.

    The weird thing in your case is the intermittent behavior. Like bcworkz said, it should just work or not work.

    Can you give us any more context as to when it ‘forgets’ the exclude category?

    Making new posts, when a comment gets added, etc. That may help identify some action that is triggering a behavior that is causing the problem.

    @trisham, I just got an email since you @lawless’d me.

    I just dropped that code in a current site I’m working on and it seemed to work as expected. I’ve got error reporting turned on, and the only thing I saw was a warning about an unset variable which wouldn’t cause your issue.

    In digging deeper it seems since WordPress 2.5 the wp_cache function this code uses, does not store wp_cache data persistently, which my be why you are seeing intermittent issues. The Exclude Category value gets stored in wp_cache, then once the cache is destroyed, your Category value gets removed.

    My guess is it’s somehow related to that. I just dug into it a little bit and didn’t see anything obvious, but it’s been 4 years since I’ve even looked at that code. I’ll try and play with it a little more this week in my spare time.

    Thread Starter lawless

    (@lawless)

    Cheers. Funny, every couple months someone stumbles onto this post and the Recent Posts w/ Category Exclude widget.

    I don’t even remember what project I used it in now, and haven’t used it since, but it’s good to see others getting some use out of it.

    Something definitely changed in core to break the old way of doing it. I had echo statements too and had to change them to return.

    I also noticed they now have a CSS background-size: 274px 63px; that has to be overwritten if you’re using a custom login logo. I’m having to write in a CSS style for .login h1 a to set the background-size to the exact size of my custom login logo.

    Thread Starter lawless

    (@lawless)

    Recent Posts Widget with Category Exclude:
    https://pastebin.com/jxDnqPqR

    Just drop that whole thing in your theme’s functions.php file and it will turn the Recent Posts widget into a Recent Posts with Exclude widget.

    Thread Starter lawless

    (@lawless)

    Link posted below.

    Hey jma666, I just ran into a similar problem with category__not_in, 'category__not_in' => array( 144, 145 ) seems to get processed as a string instead of an array, for whatever reason.

    Try putting your exclude IDs into a variable and explode that into an Array for ‘category__not_in’. This is how I got it to work in my circumstance.

    Try this example of your code:

    <?php
    $excludes = '144,145';
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts( array(
    'category__not_in' => explode(',', $excludes),
    'post_type' => 'gallery',
    'posts_per_page' => -1,
    'ignore_sticky_posts' => 1,
    'orderby' => $gogo_gallery_items_order
    					 )
    			  );
    $postcount = 0;
    if ( have_posts() ) : while ( have_posts() ) : the_post(); $postcount++;?>
    Forum: Fixing WordPress
    In reply to: 2.9.2 site hacked

    Here’s GoDaddy’s response on their Support page:

    https://community.godaddy.com/godaddy/wordpress-compromised-how-to-fix-it

    Pretty lackluster considering the scope of this problem.

Viewing 9 replies - 1 through 9 (of 9 total)