I don’t have time to produce working code for this. I will edit the answer if I get the chance.
In the meantime, you probably want a filter on upload_dir
to alter that path.
Your code would look something like this then:
function alter_upload_wpse_107016($upload) {
remove_filter('upload_dir','alter_upload_wpse_107016');
// alter $upload array
return $upload;
}
if (1 === preg_match('|regex-to-check-guid|',$terms[$i]->guid) {
add_filter('upload_dir','alter_upload_wpse_107016');
}
$gallery_image_thumb = wp_get_attachment_image_src($terms[$i]->ID, 'thumbnail');
That is completely untested and written entirely from memory. No promises but maybe it will get you started.
By the way, the guid
is not an URL, however much it may look like one, and should not be used as such (even though it was used as such by WordPress prior to something like 2.7).
Related Posts:
- get attachment title based on attachment id
- Get Image Description
- Automatically replace original uploaded image with large image size
- Media Upload Folder – how to manage
- Wrong image dimensions in Insert Media after add_image_size()
- PHP Fatal error: Call to undefined function download_url()
- Change WordPress image URLs via filter
- How to resize images in wordpress without adding any compression or changing the color profile of the images, possible?
- hook into completed image upload filter
- How can I hide media library images from general users?
- Strange img srcset behaviour
- Images uploading to wrong folder
- set_post_thumbnail_size not cropping featured images, but reducing proportionally
- Get URLs for All Sizes of Image via Admin Panel
- Automatically Add Caption in image
- Rename image during upload using date and time stamp?
- How to Optimize images after uploading all images to WordPress Site?
- Get author ID with attachment ID
- Show Post Excerpt in Image Attachement
- WP 3.4 has missing photo data
- What’s the best “insert all images” plugin?
- Image Quality Thumbnail Compression in WordPress?
- Gutenberg editor get post featured image by id
- How to add image id class?
- Local WordPress installation doesn’t crop images
- Get full URL of images in media library including http://
- wp_get_attachment_url with specific image_size?
- Get meta data from image
- Shortcode for a link and thumbnail
- Bulk edit Gutenberg single images to change from linking to media file to attachment page
- Host images only on CDN
- Fuzzy Images in WordPress 4.4
- In Wordress one author can not see the other’s author uploaded images through media library
- How to add missing dimensions to all images to avoid cls?
- Prevent Image Pasting in RichText Component
- Why are images created by WP larger than the original uploaded image?
- Default Image Link Type Setting not Working
- Fallback for missing srcset images
- max_srcset_image_width doesn’t work as intended
- Background image resets after time (XAMPP)
- Replace image caption with its title and description
- Custom thumbnail size of image when uploaded
- Removing featured image from gallery?
- Is it a good practice to change media settings on theme activation?
- Insert File URL Links to Existing Images that Were Not Originally Linked to Themselves
- Difficulties setting a maximum image width
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- Why does WP allow to view and media item as a page
- How to fix a missing image
- Function to remove all classes on images inserted into posts?
- How to get the real file type for images that do not have an extension
- Images don’t update after being edited
- Display post image in a size defined by add_image_size()
- Display attached images as background-image css
- IMG size is set to width=”964px” or “100%”, but is shown as “634px” in browser
- Remove Additional image sizes created by theme
- Prevent WP from wrapping html in caption shortcode after ‘image_send_editor’ filter is applied
- wordpress 4.22 does not generate thumbnail images
- How to implement CSS-defined images from bootstrap site in wordpress theme
- What is the best way to associate multiple images to one page?
- How can I get url from image tag in feed with fetch_feed?
- Fetch the latest post with attachment image
- How to get image name, mime type, width, height, file size from post custom field?
- Fetching uploaded images using Link URL
- Can’t seem to see images on my machine but can on the server
- get rid of random string before an for an image path on wordpress
- Image modification
- Using srcsets in a custom block
- Plugin to select the custom image crop area
- Glitched page redirects to image
- Regenerate BIG threshold scaled images
- How to Display Image Caption but Not Alt Text
- How to change background image
- I want to create a hero image with text and a button on my front page. How can I do this?
- WordPress Link To Image Missing Dropdown
- Why image Thumbnail url is not displaying with custom size?
- get_image_tag & wp_get_attachment_image_attributes behaving strangely
- add_image_size limiting sizes (???)
- Automatically generate multiple image sizes for element
- Newly uploaded images are not updating in featured image
- How to have a specific image show up for everyone who comments?
- My feature images are showing up twice on the preview page
- Uploaded Images not re-sized to ( Thumbnail, Medium, and Large ) size
- Custom styling Insert Media window
- How do I embed youtube video via url in frontend posting
- Some images don’t get linked when setting link-to to media-image
- Create a Link to Larger Image from within list of smaller images
- Thickbox not displaying just the image, instead showing full page in lightbox
- Thumbs and pictures not showing anymore
- Is there a good way to use CMS images with CSS
- Upload image from other server without resize?
- How to access & display images from a post without textual content ( and vice versa) according to best wordpress practices
- Forcing absolute src links in the RSS feed
- where is images/image.jpg?
- Using the on-board image editor for featured images: edits are not being used
- change with CSS the color of an svg background image set with “background-image: url()”
- Img alt tag showing different value then entered
- What type to upload image within theme options?
- Uncaught Error: Call to undefined function file_is_valid_image()
- Remove one srcset entry from wp_get_attachment_image