Hey @tylerthedude Yes, the code in the other thread worked for that RankMath Instant Indexing need. However, I think we need a little more. Showing to the REST API makes it available to Gutenberg:
add_filter('register_post_type_args', function($args, $post_type) {
if ($post_type == 'pretty-link') {
$args['public'] = true;
$args['show_in_rest'] = true;
return $args;
}, 10, 2);
However, that auto-completes the URL as: /?pretty-link=linkedin-profile
for example.
Whereas, what we need is the actual Pretty Link URL, eg: /link/linkedin-profile
ChatGTP suggest something like the following, although it’s late here, so I only tested once, but it didn’t work, and I’ve not had a chance to check the actual meta key value. Hope it makes sense…
function register_pretty_link_rest_field() {
register_rest_field('pretty-link', 'pretty_link', [
'get_callback' => function($object) {
// Assuming 'pretty_link_meta_key' is the meta key for your "Pretty Link" field
return get_post_meta($object['id'], 'pretty_link_meta_key', true);
},
'schema' => null,
]);
}
add_action('rest_api_init', 'register_pretty_link_rest_field');
Again, I feel a good value-adding feature, if you can ??