Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I realize I've asked similar in the past, but I've currently running in some difficulties editing/removing the admin nav menu advanced menu properties. (without using jQuery)

add_filter( 'manage_nav-menus_columns', 'cor_wp_nav_menu_manage_columns');
function cor_wp_nav_menu_manage_columns() {
  return array(
    '_title' => 'test',
    'cb' => '<input type="checkbox" />',
    'link-target' => __('Link Target'),
    'css-classes' => __('CSS Classes'),
    'xfn' => __('Link Relationship (XFN)'),
    'description' => __('Description'),
  );
}

In this case I was trying to rename the title key to something like 'test' to see if my filter would work. The outcome however stayed the same 'title' => _('Show advanced menu properties'),.

If possible, this is what I'm actually trying to accomplish:

add_filter( 'manage_nav-menus_columns', 'cor_wp_nav_menu_manage_columns' );
function cor_wp_nav_menu_manage_columns() {
  return '';
}

Would someone know what I might be overlooking perhaps?

Edit:

I'm able to remove the advanced menu properties using add_filter( 'manage_nav-menus_columns', '__return_false', 200 ); I'm however still struggling (meaning, I can't remove them) to remove the property fields

share|improve this question
    
"this should work, but unfortunately, it isn't." ... That isn't very helpful. Could you please explain in detail what you're trying, what output/errors you get and where you're stuck? –  kaiser Mar 18 '12 at 17:16
    
You're right :) In this case I was trying to rename the title key to something like 'test' to see if my filter would work. The outcome however stayed the same '_title' => __('Show advanced menu properties'),. If possible, this is what I'm actually trying to accomplish: add_filter( 'manage_nav-menus_columns', 'cor_wp_nav_menu_manage_columns' ); function cor_wp_nav_menu_manage_columns() { return ''; } –  Cor van Noorloos Mar 18 '12 at 17:26
    
:) Please move that in as edit of your Q. You know, not everyone reads the comments. –  kaiser Mar 18 '12 at 17:53
    
Please post your solution as an answer and mark it as "accepted" so people will know where to look. –  EAMann Mar 20 '12 at 16:59
    
thank you for your comment, @eamann –  Cor van Noorloos Mar 20 '12 at 17:02

1 Answer 1

up vote 1 down vote accepted

After some struggling extending Walker_Nav_Menu_Edit and using preg_replace on the property fields, I've ended with this solution:

// removes the `nav-menus.php` 'advanced menu properties' column
add_filter( 'manage_nav-menus_columns', '__return_empty_array', 200 );

add_action( 'admin_footer-nav-menus.php', 'cor_remove_nav_menu_properties' );
/**
 * Removes the `nav-menus.php` 'advanced menu properties' fields.
 */
function cor_remove_nav_menu_properties() {
?>
<script>
jQuery(document).ready(function ($) {
  $('p').remove('.field-css-classes, .field-description, .field-link-target, .field-xfn, .link-to-original');
});
</script>
<?php
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.