• I’m trying to remove some elements from a menu link.

    At the moment I’ve trimmed back the output so the menu link contains just the following:

    <li class=”home post_type page”>

    However, that’s as far as I’ve been able to trim things back to.

    My aim is to only have the following showing

    <li class=”home”>

    To get to the above I’ve modified the “nav-menu-template.php” file. I know I shouldn’t be touching core files but this was the easiest way to understand how the links are created.

    So far I do know that this:

    $class_names = $class_names ? ‘ class=”‘ . esc_attr( $class_names ) . ‘”‘ : ”;

    is what provides the output. The only bit I don’t know is how to stop the output from including “post_type page”

    This would then give me just the following

    <li class=”home”>

    I’ve tried removing all the obvious things within the “nav-menu-template.php” file that might be generating the “post_type page” text but so far without luck.

    Any suggestions on where I should be looking would be greatly appreciated.

The topic ‘How do you remove "post_type page" from menu link?’ is closed to new replies.