How to ‘clone’ select metabox options with a callback function? [closed]

Add a simple function in your functions.php file. function get_button_styles(){ return array( ‘button’ => ‘Button’, ‘button_red’ => ‘Button Red’, ‘button_yellow’ => ‘Button Yellow’, ); } Use it to get button styles in different metabox fields array( ‘id’ => ‘all_btns’, ‘name’ => ‘Button Select’, ‘type’ => ‘select’, ‘options’ => get_button_styles(), ‘callback’ => ‘metabox_clone_options’, ),

Using call_user_func() within add_settings_section() within a Class

Hi @Loni Huff: Your Code, Reformatted: It appear you are trying to call your callback with call_user_func() instead of just passing it. Reformatting your code, this is what you have: add_settings_section( ‘expansion_’ . $row->expansion_id, ”, call_user_func(array(&$this, ‘display_expansion’), $row->expansion), ‘warpress_progression’ ); // PROBLEM SEEMS TO BE HERE Equivalent to Your Code: Which is basically the same … Read more

How do i specify a url to which to redirect the user after he logs out from facebook?

A Web site that I recently worked on for a client involved tying WordPress together with another CMS including tight login integration. Because of clashes with internal functions, I could not call the WordPress logout function directly from the CMS. Intead, I created a special logout page in the WordPress root which I redirected to … Read more

Plugin default settings hook

I’d use a filter. You can remove this: if (function_exists(‘bf_new_defaults’)) { return bf_new_defaults( $default_settings ); } else { return $default_settings; } and replace it with something like this: return apply_filters(‘bf_filter’, $default_settings) The following is a truncated, proof of concept version of the code so you can see how $default_settings gets altered. add_filter( ‘bf_filter’, function($default_settings) { … Read more

Problem with Class, Filters and Callbacks

Here’s a slightly modified version of your code snippet: add_action( ‘login_head’, [ ‘WPSE_Admin’, ‘plugin_setup’ ] ); class WPSE_Admin { public static function plugin_setup() { add_filter( ‘login_headerurl’, [ ‘WPSE_Admin’, ‘the_logo_url’ ] ); } public function the_logo_url() { return get_bloginfo(‘url’); } } The filter callbacks must be public, not private. The reason for this is that apply_filters()/apply_filters_ref_array() … Read more