Display image title and caption on posts and pages

you are trying to get the image title using get_the_title($image_id), but $image_id is not defined in your function. Instead, you should use the id attribute provided in the shortcode attributes. add_filter( ‘img_caption_shortcode’, ‘my_img_caption_shortcode’, 10, 3 ); function my_img_caption_shortcode( $output, $attr, $content ) { $attr = shortcode_atts( array( ‘id’ => ”, ‘align’ => ‘alignnone’, ‘width’ => … Read more

How do I display a PDF thumbnail as a link to the PDF without uploading the image

The PDF images created by wordpress are stored within the PDF attachment object metadata. [ { “id”: 121, “media_type”: “file”, “mime_type”: “application/pdf”, … “media_details”: { “sizes”: { “full”: { … “source_url”: “<domain>/wp-content/uploads/document-name-pdf.jpg” } } ] Extracting the image from the PDF Adding an image block or adding a featured image to a post requires an … Read more

Is there a way to return a list of the default image size names when they are unset?

Call get_intermediate_image_sizes() before applying the filter (intermediate_image_sizes). Or, temporarily remove the filter, call the function to store the output, and then re-apply the filter. If you only want the list of default image sizes, then you can remove the values returned by wp_get_additional_image_sizes() from those returned by get_intermediate_image_sizes() (untested): remove_filter( ‘intermediate_image_sizes’, … ); $image_sizes = … Read more

Adding or replacing image size

It seems that this regex does the trick: wp search-replace ‘(<!– wp:image\s{(?!.*”sizeSlug”)[^}]*)’ ‘$1,\”sizeSlug\”:\”full\”‘ wp_posts –regex –regex-delimiter=”https://wordpress.stackexchange.com/” –precise EDIT: I added correction, double quotes must be escaped in replacement string in order for this to work properly. It seems that everything is first encoded in json, hence the reason. ANOTHER EDIT: This did the trick by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)