PHP permalink code in WordPress functions.php works in Chrome but not in Firefox

Screenshot

I have some PHP code that inserts a parent link (Faculty) into my Yoast breadcrumb trail. Strangely, this code works fine in Chrome, but not in Firefox.

In Chrome the breadcrumb structure is:

Home > Faculty > [category] > [category] > …

In Firefox the breadcrumb structure doesn’t insert ‘Faculty’. It looks like this:

Home > [category] > [category] > …

PHP code being used in functions.php:

add_filter( 'wpseo_breadcrumb_links', 'wpse_100012_override_yoast_breadcrumb_trail' );
function wpse_100012_override_yoast_breadcrumb_trail($links) {
    global $post;
    if (is_home() || is_singular('post') || is_archive()){
        $breadcrumb[] = array(
            'url' => get_permalink(get_option('/divdept/')),
            'text' => 'Faculty',
        );
        array_splice($links,1,-2,$breadcrumb);
    }
    return $links;
}

You can see an example of what I’m talking about at this link, and the attached screenshot:

http://www.bennett.edu/divdept/division-professional-studies/

Any idea what’s going on?

Read more here:: PHP permalink code in WordPress functions.php works in Chrome but not in Firefox

Leave a Reply

Your email address will not be published. Required fields are marked *