Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active December 28, 2017 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/d2b082c3c868136ef733adc888e63252 to your computer and use it in GitHub Desktop.
Save Shelob9/d2b082c3c868136ef733adc888e63252 to your computer and use it in GitHub Desktop.
<?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