Instant Articles for WP
Note: if wanting all Custom Post Type UI post types then you will need Custom Post Type UI version 1.3.0 or higher due to the cptui_get_post_type_slugs() function usage.
If you wan to add support for Instant articles via https://wordpress.org/plugins/fb-instant-articles/ you will need to utilize a filter made available by the plugin itself. This plugin has a different setup than the custom “supports” field highlighted above.
function my_cptui_add_post_types_to_instant_articles( $post_types ) {
// Option 1: If you want ALL of your CPTUI items.
$cptui_post_types = cptui_get_post_type_slugs();
// Option 2: If you want just some of them.
$cptui_post_types = array( 'my_post_type', 'my_other_post_type' );
return array_merge(
$post_types,
$cptui_post_types
);
}
add_filter( 'instant_articles_post_types', 'my_cptui_add_post_types_to_instant_articles' );
The code above should not be used as is, but instead a decision made if you want to use ALL post types registered with CPTUI, or if you just want support for specific ones. Option 1 will use all of them, while option 2 requres specifying the slugs to add support for.