Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




hide elements using remove_meta_box

UserPost

6:22 am
July 3, 2009


piemanek

Member

posts 7

1

Hi

Just a small (and rather picky!) point, but hopefully it's of interest to you.

I notice you use CSS display:none to hide elements on the post/page editing screen from users who do not have full capabilities.

I used to use this in some of my own plugins, but recently discovered that in recent versions of WordPress a much better way is to use remove_meta_box, for example remove_meta_box('passworddiv','post','core').

It's called from the admin_menu hook: add_action( 'admin_menu', 'my_function_to_remove_boxes' );

I think it's a much more secure way of doing it than hiding the divs with CSS.


10:16 am
July 3, 2009


Kevin

Admin

posts 2402

2

piemanek said:

Hi

… recently discovered that in recent versions of WordPress a much better way is to use remove_meta_box, for example remove_meta_box('passworddiv','post','core').



I didn't realize that function would remove any div from the edit form (not just "meta boxes"). Thanks for the tip; the change is now in place in the updated Role Scoper dev snapshot.

11:55 am
July 3, 2009


piemanek

Member

posts 7

3

glad to be of use :-)

and yeah, it's not the best name for the function really, took me a while to discover that too…


About the Agapetry forum

Currently Online:

14 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1186

Posts: 5409

Members:

There are 1176 members

There are 1 guests


Kevin has made 2402 posts

Top Posters:

metal450 - 159

Ragnar - 105

YikYak - 70

whiteorb - 44

Daisy - 35

Administrator: Kevin | Moderators: Kevin