0

I'm working on a website and added a custom meta option for all pages / posts called: "Location".

$value = get_post_meta( $post->ID, '_privacy_location', true );

I'd like to add the value on the menu item in: Appearance->Menus so my client can see what pages have which location !

Can't figure out what hook to use ! Help plz :)

3
  • Try this: justintadlock.com/archives/2011/06/27/…
    – GhostToast
    Commented Jun 3, 2013 at 14:59
  • Thanks, but I need to do this for the Menu, not the pages / posts
    – sirmdawg
    Commented Jun 3, 2013 at 15:18
  • Ah, sorry, misunderstood. Thought you meant 'admin menu', despite you clearly saying "apperances->menu".
    – GhostToast
    Commented Jun 3, 2013 at 15:19

1 Answer 1

3

The menu items boxes are created by the class Walker_Nav_Menu_Edit in wp-admin/includes/nav-menu.php.

Thus to alter those boxes you'll have to make your custom Walker I guess.

But if you mean adding the new value to the nav menu meta-boxes (the boxes to the left side of the page) this will do the job:

The function that adds new meta_boxes:

function my_function() {
   add_meta_box( 'foo', __( 'Fooo' ), 'callback_function' , 'nav-menus', 'side', 'default' );
}

The callback that renders the output for the new boxes:

function callback_function( ) {
  global $wp_meta_boxes;
  var_dump($wp_meta_boxes);
}

And you can use both:

add_filter( 'manage_nav-menus_columns', 'my_function');

or

add_action('admin_init', 'my_function');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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