Support » Fixing WordPress » Category Name causing problems

  • Resolved anatman



    I have just faced a problem where i wouldn’t be able to list the posts in a category. All other categories would behave normally, except this one.
    First i found out that changing the name and slug of the category would make the problem go away and come back. Oddly enough, i narrowed the problem to the category name, or so it seems.

    Using a name like “Distraí-me”, with the accented “i”, caused the problem, but changing the name to “Distrai-me” ceases the problem. The code i am using to display the category posts is:
    <?php query_posts(array('category_name' => single_cat_title('', FALSE), 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => '-1')); ?>

    Please note that i am reffering to categry name, not slug. I suspect there is a problem with sanitizing the accented characters in category names (i had a similar problem before with the word “Vídeos”, which i solved by accident).

    Can anyone help me with this, or help me to open an entry in the trac? (i can’t really tell if this has already been reported).

    Thank you,

Viewing 2 replies - 1 through 2 (of 2 total)
  • your code is simply ignoring the documentation:

    Please note that i am reffering to categry name, not slug.

    the codex states clearly that you need to use the slug:

    category_name (string) – use category slug (NOT name).

    you could try and work with the category id:

    <?php query_posts(array('cat' => get_query_var('cat'), 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => '-1')); ?>

    Hi alchymyth,

    Now i understand what is going on! The code generating my page is from a premium theme, i just assumed it was right – sorry for the bug thing. If a moderator would correct this thread’s title and remove the word bug, i’ll be gratefull.

    Thanks a lot fro your help and for the code sugestion, i will try it now.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category Name causing problems’ is closed to new replies.