• I would like to exclude some pages from my wp_pages menu. But I need to exclude pages by title.

    I came across something very close to what I need below.

    function categories_without_title_attribute() {
    $categories = wp_list_categories('echo=0');
    $categories = preg_replace('/title=\"(.*?)\"/','',$categories);
    echo $categories;
    }

    It provides a function to call pages without the title attribute.
    What I need is to amend it so I can exclude pages that have specific titles. For example, let’s say ‘About Us’ and ‘Privacy Policy’.

    I have tried many variations but no effect. A number ofpeople have asked for this solution but there is nothing that works posted yet.

    ANy preg_replace experts have a solution that could build on the above function?

    Many thanks

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘preg_replace question’ is closed to new replies.