• Resolved meatberg

    (@meatberg)


    Could use someone’s help, I am sure this is a simple change to my code but for the life of me I can’t get it sorted. Here’s the issue:

    I use WordPress as a backend publishing tool for various sites (see https://www.naturopathy-uk.com/resources/resources-careers/ – Careers is a category in WP with multiple posts in that category. In this instance I’m calling the whole category). The sites are just PHP templates with code (below) that makles the following calls to pickup the category(ies) or post(s) where I designate them to appear in the page template:

    CATEGORY

    <?php 
    
    include "includes/snoopy.class.php";
    $snoopy = new Snoopy;
    
    $snoopy->fetch("https://www.blahblah.com/blog/?cat=11");
    print $snoopy->results;
    
    ?>
    
    POST
    
    <?php 
    
    include "includes/snoopy.class.php";
    $snoopy = new Snoopy;
    
    $snoopy->fetch("https://www.blahblah.com/blog/?p=11");
    print $snoopy->results;
    
    ?>

    Now this worked fine in everything but 2.3. I upgraded and can now BROWSE, for example, https://www.blahblah.com/blog/?cat=11 (although it defaults to the SEF permalink whereas before it just kept the same string in the address bar), but can no longer call it via the actual page template.

    I rolled WP back to 2.2.2. Now, can anyone tell me, instead of calling ?cat=11, what should I be calling? It ain’t ?term=11, that doesn’t work. Some bright spark must know this, I can post the template code if anyone’s interested.

    Cheers,

    – Rob

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    ?cat=number is still correct. Although the number may not be “11” anymore. The migration changes all the numbers because it’s moving everything into new tables. So check your Manage->Categories page for the correct category ID number.

    Thread Starter meatberg

    (@meatberg)

    nope, it still doesn’t work, even with a known good category. you can try parsing it yourself. drop this into a .php file and load it up onto your server (you have to load snoopy as well):

    <?php

    include “includes/snoopy.class.php”;
    $snoopy = new Snoopy;

    $snoopy->fetch(“https://www.rocheleau.co.uk/?cat=1&#8221;);
    print $snoopy->results;

    ?>

    https://www.rocheleau.co.uk/?cat=1 is a known good category in a functioning 2.3 install. i SHOULD be able to call it using the code above, but can’t. i can browse it, but not call it. i can only call categores by acessing the feed with a parser, like https://www.rocheleau.co.uk/feed?cat=1.

    i can’t figure this one out. 48 hours on it and so far still no joy…

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Well, I really don’t know what to tell you except that you’re wrong. It does work correctly. I use it myself. I just tested it on my own site running 2.3 and it behaves exactly as expected.

    Sorry, but my original answer was correct. So you’re doing something else wrong.

    I just noticed that you said this:

    i can browse it, but not call it.

    That really doesn’t make any sense. There’s no difference between the two things. EXCEPT that you’re using Snoopy. Snoopy doesn’t handle redirects, and one new thing about 2.3 is that it always sends a redirect to the correct permalink. So if you go to ?cat=1 and you’re using some other form of permalink, WordPress will send a 301 redirect to send you to /category/whatever instead. Your browser will handle this, Snoopy won’t.

    Solution: Don’t use Snoopy. Use something else that works correctly instead.
    Alternate solution: Use the correct permalink in the first place instead of the ?cat=1.

    Thread Starter meatberg

    (@meatberg)

    I’m not sure where the sneering, pedantic response comes from (I wasn’t challenging your response, just indicating my results), but the fact is that I changed nothing in my code (wrong as it may be) and it worked before I upgraded to 2.3, and I’m trying to understand why. Calling /category/whatever doesn’t work either (I tested this right off the bat), regardless of permalink structure. Of course, I may be doing something else wrong. However, I haven’t changed anything other than the upgrade to 2.3. I’ve tested it using c-U-R-L and it doesn’t work, either, where it did previously.

    If you want to help, help. If you want to be insulting, then please go elsewhere.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    If you thought that was insulting, then I hate to think what you might think when I’m actually trying to *be* insulting. Remember that this is a medium of text. Any “sneering” is just you projecting onto what you read, I certainly am not putting it there intentionally. This sort of thing happens a lot on these forums, people get frustrated and think we’re insulting them. It’s the frustration, not us. We don’t know you well enough to dislike you. ??

    Anyway, what’s changed in 2.3 is pretty much what I told you. WordPress 2.3 does permalink redirects. I’ll give you an example to help you understand it better.

    You posted this URL: https://www.rocheleau.co.uk/?cat=1 . Click it. Look at the URL that *actually* shows up in your browser. That URL looks suspiciously different, doesn’t it? WordPress 2.3 redirected you to the correct URL, which is currently https://www.rocheleau.co.uk/category/bob/ . It does this do help search engines find the correct URLs for your site, and it is a new feature in 2.3.

    Snoopy and CURL and some other tools don’t generally follow redirections by default. You might be able to make them work, somehow, but I really don’t know how.

    Anyway, this is why your code doesn’t work. WordPress has a new feature designed to force browser and search engines and other tools to use the correct URLs for your site. The “default” URLs still work, but are redirected to the correct URLs given your sites current configuration. Your code doesn’t account for that. So, you can either correct the code to account for redirects (I don’t know how, sorry) or you can use the correct URL which won’t get redirected.

    That help any?

    Calling /category/whatever doesn’t work either (I tested this right off the bat), regardless of permalink structure.

    Make sure you have the ending / on the URL. It’s *not* optional. Anything other than the exact URL will get redirected and cause the same issue.

    Thread Starter meatberg

    (@meatberg)

    ok, so maybe i wasn’t clear:

    <?php

    include “includes/snoopy.class.php”;
    $snoopy = new Snoopy;

    $snoopy->fetch(“https://www.rocheleau.co.uk/category/bob/&#8221;);
    print $snoopy->results;

    ?>

    doesn’t work either (or using CURL).

    sorry if i misinterpreted your tone on your post…but telling someone they’re wrong (repeatedly), even in a text medium is still needless and unhelpful. anyway, thanks for the effort.

    Thread Starter meatberg

    (@meatberg)

    this is a hosting-related issue. as otto42 stated, it does work using the correct URL. just not on my host’s servers. i should’ve checked it on another host before posting, sorry for that.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘?cat=7 or is it now ?term=7’ is closed to new replies.