Forums

[resolved] problem with query_posts and $args (since WP3.3.1) (4 posts)

  1. vnvsven
    Member
    Posted 4 months ago #

    Hello everyone,

    I used following simple code and this works nice:

    <?php
    $args = array(
             'category_name'   => 'Releases',
             'post_type'       => 'release',
             'tag'             => $newstag,
             'meta_key'        => 'release_date',
             'orderby'         => 'meta_value',
             'order'           => 'DESC'
             );
    
    query_posts($args);
    ?>

    Since I updated to WP 3.3.1 this code doesn't work anymore. :(

    I don't know why, because $newstag is only a string and comes from the default 'post_tag' taxonomy. I also verified the $args-array with print_r() and the correct values are there.

    When I modify the code for testing and enter a static text instead of $newstag, all works fine and the result is correct.

    Can anybody verify this on WP 3.3.1? Or did I overlooked something since the latest releases (I updated from 3.2.1 to 3.3.1)?

    Thanx a lot for your help!

  2. vtxyzzy
    Member
    Posted 4 months ago #

    I think the problem might be that you are using the category name for category_name. In spite of the label, it requires the slug for the category, probably 'releases', not 'Releases'.

  3. vnvsven
    Member
    Posted 4 months ago #

    Thank you for your response.

    I tried it first as you wrote, later I delete all other (not so important) parameters in this array for testing. At the end I tried it only with this code:

    <?php
    $args = array(
             'post_type'       => 'release',
             'tag'             => $newstag
             );
    query_posts($args);
    ?>

    Still the same problem. :(
    Any other ideas? Thank you again!

  4. vnvsven
    Member
    Posted 4 months ago #

    So ... I found the error ... my $newstag comes with a blank an the end into this array. Puhhh ... now all works fine. :D

    Thank you for your help.

Reply

You must log in to post.

About this Topic