Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
register_meta('user', 'xp',
[
'sanitize_callback' => 'absint',
]
);
<?php
register_meta('user', 'xp',
[
'sanitize_callback' => 'absint',
'show_in_rest' => true,
]
);
<?php
register_meta('user', 'xp',
[
'sanitize_callback' => 'absint',
'show_in_rest' => true,
'type' => 'integer',
'description' => 'The total experience points earned by this user, as a positive integer',
]
);
<?php
register_meta('user', 'xp',
[
'sanitize_callback' => 'absint',
'show_in_rest' => true,
'type' => 'integer',
'description' => 'The total experience points earned by this user, as a positive integer',
'auth_callback' => function(){
return current_user_can( 'some-cap' );
}
]
);
<?php
register_meta( 'user', 'xp', 'absint' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.