How do get post thumbnail into plugin?

I dont know where you are using/inserting this code, but maybe you need the current post ID. Try using get_the_post_thumbnail_url( <post-ID> ,<thumbnail-size> ); To get the ID of the current post you can for example use $current_id = get_the_ID();. Than you can try $src = get_the_post_thumbnail_url( $current_id ,’post-thumbnail’ ); to get the URL.

How can I add a “data-pin-nopin” the featured image html?

Simply edit your themes header.php and place the following snippet between the <head></head> tags to prevent pinning globally. <meta name=”pinterest” content=”nopin” /> Alternatively you can use the Pinterest Block plugin from which offers you more fine-grained control, also for single posts. This plugin allows you to block selected posts and pages from getting pinned on … Read more

Create thumbnail size only for a few images?

Yes, you can choose to regenerate the thumbnails for specific images. You have 2 options. 1- Create a simple plugin Generating thumbnails is done via the wp_generate_attachment_metadata() function, which you can use to generate thumbnails manually. To do so, make a simple plugin that loops through a couple of attachment IDs and generates thumbnail for … Read more

Including post thumbnail url in loop’s post object to reduce number of queries

I believe you can fetch that data using setup_postdata() which lets you access all the data relating to a post and use it with standard template tags (in your case, the_post_thumbnail). There is a great tutorial here: https://wpshout.com/setup_postdata-template-tags-need-custom-wp_post-arrays-crave/ Important to note that you first have to setup the global $post and you have to be … Read more