Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

TimG1 on "How do I pass arguments using add_action() to an existing action?"

$
0
0

Hello everyone,

Instead of doing something like this...

function remove_taxonomy_boxes() {
            remove_meta_box('categorydiv', 'post', 'side');
    }
    add_action( 'admin_menu' , 'remove_taxonomy_boxes' );

Is it possible to do something more like this?

function remove_taxonomy_boxes($box_id, $page, $context) {
            remove_meta_box($box_id, $page, $context);
    }
    add_action( 'admin_menu' , 'remove_taxonomy_boxes', 10, 3 );
    do_action( 'admin_menu', 'categorydiv', 'post', 'side');

I understand the second code example is incorrect, but the idea is what I'm trying to do. I want to try and make my code a little more reusable instead of having to write the first code example's custom function with hard coded values for every case I want. Maybe there is an entirely different approach?

I found this thread, it's closed though and not quite what I'm looking for.

Many thanks!
-Tim


Viewing all articles
Browse latest Browse all 8245

Trending Articles