Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do_action first default parameter is always blank when not passed #440

Open
phylaxis opened this issue Aug 1, 2017 · 0 comments
Open

do_action first default parameter is always blank when not passed #440

phylaxis opened this issue Aug 1, 2017 · 0 comments

Comments

@phylaxis
Copy link

phylaxis commented Aug 1, 2017

I'm having a small issue trying to set up functions in class-plugin-theme-public.php that has a default parameter. I'm not sure if this is a Wordpress issue, a Boilerplate issue, or just me not understanding the do_action method. What happens is I define a function like this:

public function plugin_contact_info( $show_logo=true ) {

    var_dump( $show_logo );

}

Then inside the class-plugin-theme.php's define_public_hooks method I call:

$this->loader->add_action( 'show_plugin_contact_info', $plugin_public, 'plugin_contact_info' );

Finally when I call the do_action like this:

do_action('show_plugin_contact_info');

I would expect a the var_dump to be bool(true), but what I am getting is: string(0) ""

So my question is WHY?

It doesn't seem to be accepting the default as set in my function, or more specifically, the do_action call ALWAYS seems to pass blank as the first parameter if one is not defined in the call. Is this standard for Wordpress? Why would it not pass NULL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant