Viewing 15 replies - 1 through 15 (of 21 total)
  • unfortunately, only fixed my problem, partially.
    result seems messy, if there’s more than one CPT-onomy attached

    tried to contact Rachel Carden via Twitter, but got no response yet

    Thanks for posting something. I tried the suggestion but my line 517 is an IF statement. I’m not completely sure which line(s) to change. I tried a few different changes and nothing improved. I think I’m missing something.

    Looks like my file is older. Should be line 533 in manager.php.

    The incorrect line reads:
    // remove 0 = 1
    $clauses[ ‘where’ ] = preg_replace( ‘/0\s\=\s1\sAND\s/i’, ”, $clauses[ ‘where’ ] );

    REPLACE with:
    // remove 0 = 1
    $clauses[ ‘where’ ] = preg_replace( ‘\(\s/0\s\=\s1\s\)\sAND\s/i’, ”, $clauses[ ‘where’ ] );

    Thanks. I tried this and it brought back results but showed a PHP warning that the delimiters can’t be alphanumeric or backslash. I tried playing around with it a bit and adding a few echos. It looks like the where clause wipes out and just leaves the CPT-tonomies portion. I guess that’s why the results are coming back?

    If I add in a slash up front
    $clauses[ ‘where’ ] = preg_replace( ‘/\(\s/0\s\=\s1\s\)\sAND\s/i’, ”, $clauses[ ‘where’ ] );

    I then get a warning about modifier on 0. If I remove the / before 0 I’m back to no results.

    You can use

    echo $GLOBALS[‘wp_query’]->request;

    to see what the end request of the query is. Without the change you’ll see ( 0 = 1 ), which obviously will return false. Try it with your change and see what the sql query returns. I think it won’t find the ( 0 = 1 ) and replace it with nothing.

    Thanks. I played around a bit more and even force removed the (0=1) by removing the first X characters from the string. The pattern match didn’t seem to be working. The page I’m using the query is as a secondary query and not the primary – so I’m not sure if that’s why it’s not working. I’ll have reset and start again with fresh eyes.

    Here’s where I landed. It’s rough but working for the moment.

    // remove 0 = 1
    $clauses[ ‘where’ ] = preg_replace( ‘/0\s\=\s1/i’, ”, $clauses[ ‘where’ ] );

    // remove empty () and Extra AND
    $clauses[ ‘where’ ] = preg_replace( ‘/AND\s\(\s\n\s\s\n\)/i ‘, ”, $clauses[ ‘where’ ] );

    The short story is that (at least in my version), there are stray whitespace and line return characters surrounding the 0=1 so the pattern match needed to be tweaked. It wasn’t until I did a query echo AND viewed the source did I find this. I am curious is this is true for others.

    The outstanding issue I’m noticing is that clicking the relationship link from the posts admin page isn’t bringing everything back. It’s linking on slug and the query is sometimes doing weird things. Adding extra where conditions and not always correctly pulling all associated posts. Forcing the “relationship” post ID int the URL seems to bring everything back. I haven’t tried to dig into where that tweak is yet.

    Thank you for working on this patch guys. Saved me a ton of time!

    Thanks a million! Really great work.

    Hopefully this plugin becomes premium some time so It gets updated more often and I don’t have to worry about my clients sites crashing.

    Thanks for the patch guys. Let’s hope the dev finally replies and releases an update. I’ll report the current version as “not working” with WP 4.1.

    Hey guys! Thanks for being patient with me. I just tweaked the code and I’ll try to get the update out in the next few days. I want to try to check out some other code before I ship.

    Here’s what I ended up doing to fix the line:

    // remove 0 = 1
    $clauses[ 'where' ] = preg_replace( '/\([\s]*0\s\=\s1[\s]*\)\sAND\s/i', '', $clauses[ 'where' ] );

    Thanks Rachel,

    Hopefully this plugin becomes premium some time so It gets updated more often and I don’t have to worry about my clients sites crashing.

    +1
    I have several sites using this plugin. Recently updated to WP4.1 and saw an error. I would love to continue using this plugin as it has solved several problems using a single solution. It is one plugin I would definitely support.

    Rachel, I have used this plug to create reusable, easy to use custom sidebar widgets on number of sites, which I feel could easily be useful to the community. Essentially it adds as CPT-onomy for pages and/or posts, that displays custom sidebar content with minimal coding.
    Here’s a sample: https://sandbox.sogwap.net/sidebar-widget-demo/

    You’re most welcome!

    I realize I haven’t been able to pay much attention to CPT-onomies in a while and it’s because I keep myself pretty busy with a full time job and freelance work.

    In order to be able to give CPT-onomies more attention, I’ve decided to make a premium version, which I’m working hard on right now and hope to publish in the next few months.

    I’m also working hard on an update for the current, free version to help get rid of some of these bugs so look for an update soon. Maybe today. If not today, then the next day or two.

    Is your widget displaying CPT-onomy terms/relationships?

    I just pushed out an update that hopefully fixes this for you. If you’re still having this issue after you upgrade to version 1.3.2, please let me know.

    Thanks!

    Thanks Rachel –

    The update looks good for the published pages. Just tested it on a copy of my production site. I’m still noticing some oddities on the admin page. I have 2 CPTs – events and organizers. If I click the organizer link on the events list page it brings back 7 events. If I force in the ID number into the URL string, it brings back all 10 events tied to the organizer. I can’t decide if it’s some weird corruption with this one particular set of events/organizer or something to keep an eye on in general. The important part is that on the published pages all 10 events are being displayed but I’m also using the ID number for the query ??

    Thanks again for the update!

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Query Not Working in 4.1’ is closed to new replies.