WordPress.org

Support

Support » How-To and Troubleshooting » get_page_by_title() not working with ampersands

get_page_by_title() not working with ampersands

  • Hi
    I am trying to match up some categories and pages with this code:

    //get the title of the post
    $thispage = single_cat_title(”,false);
    //get the page of the same title
    $page = get_page_by_title($thispage) ;

    However get_page_by_title() doesn’t seem to work if the post title has ampersands in it. I have tried escaping etc but that doesn’t seem to work.
    Does anyone know of a way to make this work?

    thanks

  • The topic ‘get_page_by_title() not working with ampersands’ is closed to new replies.