WordPress.org

Support

Support » Themes and Templates » query_post for Child page or Page with – or — in it creates error

query_post for Child page or Page with – or — in it creates error

  • Hello, I was trying to use this tag:

    <?php
    query_posts('pagename=parent/child'); // retrieve the child page of a parent
    ?>

    as seen on http://codex.wordpress.org/Template_Tags/query_posts

    However, when I do—for example—the following, I get errors (as in, the page does not get called and it instead shows the text for “nothing posted yet”)

    pagename=about/history
    or
    pagename=about-history
    or
    pagename=about-—-history

    They all won’t bring up the post…

    The only pagename tag that I can get to work is when the title has no dashes in it…

    Any help, please???

    Many thanks!

Viewing 1 replies (of 1 total)
  • esmi

    @esmi

    Forum Moderator

    Try using:

    <?php query_posts('pagename=child');?>

Viewing 1 replies (of 1 total)
  • The topic ‘query_post for Child page or Page with – or — in it creates error’ is closed to new replies.
Skip to toolbar