wp_get_attachment_url not fetching URL?

then check like that: $thumb_id = get_woocommerce_term_meta( $subcategory->term_id, ‘thumbnail_id’, true ); $term_img = wp_get_attachment_url( $thumb_id ); and check like this $meta = get_term_meta( $subcategory->term_id ); var_dump($meta); $thumb_id = $meta[‘thumbnail_id’][0]; $term_img = wp_get_attachment_url( $thumb_id ); and you also get like this $thumbnail_id = get_term_meta( $subcategory->term_id, ‘thumbnail_id’, true ); $image = wp_get_attachment_url( $thumbnail_id );

Blog replace single post page featured image

Try with uploading the bigger size image and then call it based on the requirement : the_post_thumbnail( ‘thumbnail’ ); // Thumbnail (150 x 150 hard cropped) the_post_thumbnail( ‘medium’ ); // Medium resolution (300 x 300 max height 300px) the_post_thumbnail( ‘medium_large’ ); // Medium Large (added in WP 4.4) resolution (768 x 0 infinite height) the_post_thumbnail( … Read more

How to add a default predefined thumbnail when creating a brand new post?

I found an adequate solution. Generally, I used the save_post_{$post->post_type} hook which gave me a $post_ID and a $post object. I was just checking to see if there was a thumbnail and if is not there to add it. That is all. add_action( ‘save_post_book’, function ($post_ID, $post){ if ( get_post_meta($post_ID, ‘_thumbnail_id’, true) ) : return; … Read more

Which filter fires upon setting a featured image

A nearly identical use case for your question is found in the WordPress documentation for the filter admin_post_thumbnail_html. A filter hooked to this will receive the HTML for the admin screen as $content. Modify and return this markup as you wish. function filter_featured_image_admin_text( $content, $post_id, $thumbnail_id ){ $help_text=”<p>” . __( ‘Please use an image that … Read more