Skip to content

Add 'auth_callback' argument to register_meta()#38

Open
r-a-y wants to merge 2 commits intohumanmade:v2.0from
hwdsb:fix/auth_callback
Open

Add 'auth_callback' argument to register_meta()#38
r-a-y wants to merge 2 commits intohumanmade:v2.0from
hwdsb:fix/auth_callback

Conversation

@r-a-y
Copy link
Copy Markdown

@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