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

register_setting 3rd argument is array since 4.7.0 #104

Open
achchu93 opened this issue Sep 14, 2020 · 3 comments
Open

register_setting 3rd argument is array since 4.7.0 #104

achchu93 opened this issue Sep 14, 2020 · 3 comments

Comments

@achchu93
Copy link

achchu93 commented Sep 14, 2020

Since WP 4.7.0 register_setting's 3rd parameter is an array. Please update it in the code...

@roidayan
Copy link
Contributor

it's already passed as array
line 153
register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );

maybe you should be more specific.

@achchu93
Copy link
Author

achchu93 commented Sep 15, 2020

@roidayan I think you should read the question correctly. See, on that line 153 the 3rd parameter is a callback. But as per the wordpress doc it should be an array. Within that array only you should have a key as 'sanitize_callback'. if you just send the callback function as third parameter we cant have type and other keys of array.

https://developer.wordpress.org/reference/functions/register_setting/

@roidayan
Copy link
Contributor

roidayan commented Sep 19, 2020

I see what you mean. Not sure it's important at all. It is backward compatible to allow passing only a callback. And then it will be treated as an array with a sanitize_callback key only.
Do you hit any issue?

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

2 participants