How to add Support to show Fullwidth Featured Image of Custom Post Types in WordPress.?

This happens when the image does not have a specific width/height. The image you try to load in your custom-post-type is too small (379x354px). So LinkedIn, Facebook or others will use the layout with the smaller image. Facebook says: Images that are at least 470×246 pixels will display as a rectangle with the title and … Read more

Fetching custom post type without knowing post type (REST API)

You could create a generic REST API endpoint that just accepted a post ID. I’ve used the default WP_REST_Posts_Controller to handle some standard checks and format the response: add_action( ‘rest_api_init’, function () { register_rest_route( ‘wpse/406874’, ‘post_data/(?P<id>\d+)’, [ ‘methods’ => WP_REST_Server::READABLE, ‘permission_callback’ => ‘__return_true’, ‘callback’ => function ( WP_REST_Request $request ) { $id = (int) $request[‘id’]; … Read more