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

Add 'auth_callback' argument to register_meta() #38

Open
wants to merge 2 commits into
base: v2.0
Choose a base branch
from

Conversation

r-a-y
Copy link

@r-a-y r-a-y commented Oct 9, 2020

Because the 'unpublish_timestamp' meta key is marked as protected:

add_filter( 'is_protected_meta', __NAMESPACE__ . '\\protect_meta_key', 10, 3 );

No one is able to update the unpublish timestamp by default in the REST API and hence, the Block Editor:
https://github.com/WordPress/WordPress/blob/5affd982a05df50af14104e466c26822974475f0/wp-includes/meta.php#L1339-L1346

This commit adds the 'auth_callback' argument in the register_meta() call and uses current_user_can( 'edit_posts' ) to determine whether the current user can update the unpublish timestamp.

Because the 'unpublish_timestamp' meta key is marked as protected,
no one is able to able to update the unpublish timestamp by default.

This commit adds the 'auth_callback' argument and uses
current_user_can( 'edit_posts' ) to determine whether the current
user can update the unpublish timestamp.
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

Successfully merging this pull request may close these issues.

1 participant