How to: Remove Marketpress Automatic Links

A quick guide for those wanting to remove the automatically added product/shopping cart/order status links created by the Marketpress Plugin.

Goto the plugin folder and edit marketpress.php

You need to edit line 123 from:
add_filter( 'wp_nav_menu_objects', array(&$this, 'filter_nav_menu'), 10, 2 );

And comment it out to:
//REMOVE AUTO LINKS add_filter( 'wp_nav_menu_objects', array(&$this, 'filter_nav_menu'), 10, 2 );

I hope this helps,

Andy

  • Alexander

    Hi @heading,

    There are a couple alternatives here that don't involve modifying MarketPress directly. This helps keep things update proof.

    Method 1 - If you look at the code, you see if checked to see ifa constant is defined first:

    if ( !defined('MP_HIDE_MENUS') ) { //allows you to hide MP menus
    add_filter( 'wp_list_pages', array(&$this, 'filter_list_pages'), 10, 2 );
    add_filter( 'wp_nav_menu_objects', array(&$this, 'filter_nav_menu'), 10, 2 );
    }

    So you can simply add this to your wp-config.php file, and those menu filters won't run.
    define('MP_HIDE_MENUS',true);

    Method 2 - If you're only interested in stopping the 2nd line, you can "unhook" it, by removing that action with this code:

    add_action( 'init', 'remove_unwanted_hooks',999 );
    function remove_unwanted_hooks() {
        global $mp;
        remove_action( 'wp_nav_menu_objects', array($mp,'filter_nav_menu'), 10, 2 );
    }

    You can place this code in functions.php of a theme (or Child Theme), in your own plugin, or using something like Code Snippets.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.