• Hi
    I have a site which I am currently testing but at the top I am getting this error:

    Warning: preg_replace() [function.preg-replace]: Unknown modifier ‘a’ in /home/widneswe/public_html/nctest.co.uk/anfield/wp-content/themes/anfieldindex/header.php on line 92

    When I look on header.php line 92 there is no ‘a’ modifier.

    Code`<nav id=”main-menu”>
    <?php
    echo preg_replace(array(
    ‘/\t/’, // remove tabs
    ‘/’.str_replace(‘//’,’\/\/’, get_bloginfo(‘url’)).’/i’, // remove full URL
    ‘/current_page_item\s*/i’,
    ‘/current_page_ancestor\s*/i’,
    ‘/current_page_parent\s*/i’,
    ‘/page_item\s+/i’,
    ‘/page-item-\d+\s*/i’,
    ‘/children\s*/i’,
    ‘/\s*class=[“\’][“\’]/i’, // empty classes
    ‘/\s*title=”[^”]+”/i’, // all titles
    ‘/\s+>/i’,
    ‘/div>/i’ // change div to nav
    ),
    array(
    ”,
    ”,
    ‘active’,
    ‘open’,
    ”,
    ”,
    ”,
    ”,
    ”,
    ”,
    ‘>’,
    ‘nav>’
    ),
    wp_nav_menu(array(‘container’ => ”, ‘theme_location’ => header, ‘menu_class’ => ”, ‘echo’ => false))
    );
    ?>
    </nav> `

    The only part of code which has preg in it is this section from line 61 onwards to closing at line 94. I think it is to do with the menu but not fully sure, does anyone have an idea on this?
    Thanks

Viewing 1 replies (of 1 total)
  • I think your problem is in the str_replace line:

    '/'.str_replace('//','\/\/', get_bloginfo('url')).'/i', // remove full URL

    It is replacing the double slashes after http:, but not the single slashes in the following parts of the URL. My guess is that part of the URL looks something like this:

    http://mysite.com/apage/ and the a in apage is what is being reported in the error message.

Viewing 1 replies (of 1 total)

The topic ‘preg_replace error?’ is closed to new replies.