As you want to change (use different) URL for featured image only, you can use pre_option_upload_url_path
hook.
// Setting the uploads directory URL
function wpse_change_featured_img_url() {
return 'http://www.example.com/media/uploads';
}
add_filter( 'pre_option_upload_url_path', 'wpse_change_featured_img_url' );
This hook will not change URLs permanently but it will set uploads directory to some different URL temporally.
This will also not change URL of post images, you will have to change them manually or with SQL query.
Related Posts:
- Hook for URL Request
- Add custom URLs to WordPress’s XML sitemap
- Best action hook for placing ical requests
- Is there a hook that runs after a user logs in?
- WP Cron Doesn’t Execute When Time Elapses
- Why do some hooks not work inside class context?
- Action hook for custom tax edit
- Is there a limit to hook priority?
- Auto-retrieve YouTube Image for Thumbnail?
- Do WordPress Core Filenames Work as Hooks?
- How to check if which hook triggered the call to a function?
- How do I flush the rules after saving settings using the Settings API?
- Run javascript code after wp_login hook?
- Is it possible to save/modify a post without calling the “save_post” action hook?
- Redirect logged in users if they are on a specific page
- Generating robots.txt dynamically
- Hooks are not executing
- Rest API Hook When Post Is Requested
- Best possible way to get all options
- wordpress custom modules/widget areas on the page? can i make my own?
- How to add hook to the_title() and get_the_title()
- hook to get (and change) the search string before processing
- Hooking after get_header()
- How to get post ID in post_updated action hook?
- How can I set status=’publish’ for all featured images?
- Gutenberg gallery hook errors
- How to send data from a form created by a plugin to an external API?
- How to get all functions with priority ‘1’ attached to hook ‘wp_head’
- How to change the location of admin notice in html without using Javascript?
- Why doesn’t wp_enqueue_script() work when including a JavaScript file with TEMPLATEPATH?
- What are the differences between comment_form_logged_in_after and comment_form_after_fields?
- Detect change to user_meta and retrieve old and new values
- Featured Image Action Hook
- How to find a callback attached to a bbpress hook?
- Event Calendar using insert_post_data after save_post and insert_post after post_transition draft_to_schedule
- How to extend custom (non-core) blocks?
- Hooking into the init action will fire it too frequently?
- User update hook
- register_activation_hook not updating
- Redirect customer to login if not logged in when proceeding to checkout
- PHP header() gives headers already sent
- Send along login credentials with comment content
- How to replace a function using a child theme?
- WP_query hooks before execute a search query
- How to pass argument to wp_footer hook with data from a template
- Redirecting from login
- How to use a 3rd party library to send emails?
- I would like to send a notification email (Asana) whenever something is published (posts, pages, custom post types) [duplicate]
- Woocommerce table is missing a heading–can I add it by use of a hook?
- How to cancel an action hooked to untrash_post? or any hook
- Use a variable created in get_header to calculate stuff in wp_footer
- register_deactivation_hook argument -> pass arguments in the selected function
- Alternative to new_to_publish Hook for Custom Statuses
- How to use a WooCommerce action hook?
- Force file download in WordPress
- How to use pre_get_posts
- hooks for automatic approve user registration according to data in custom fields
- How to render an element, that was saved as a template, using a hook?
- How to use embed_content hook?
- WordPress plugin activation, deactivation and uninstall hook not being triggered
- Notify admin when Custom post meta data gets updated or deletet
- WP Cron not executing after timespan
- Action hook with wrapper html
- call php file from form and use wp functions
- wp_insert_post hook for a wordpress plugin
- WordPress add_action the_post hook
- Post via wp-admin and via iOS app, same hooks and triggers involved?
- add_action hook for links.php page
- Restrict editing of post type to list stored in user meta
- Hooking after blog info update
- Hook to add_action(‘updated_option_my_option’, [$this, ‘save_data’], 10, 3]);
- Session management issues with WordPRess 404 Error page
- Template_redirect works, but headers aren’t sent when checking via cURL
- template_redirect hooks redirect wrong URL
- Registered custom dynamic tag not appearing
- Add a Call to Action Button to WordPress Post Thumbnail
- How to hook add_action() into after category description with id?
- What hook can you use to get the full response?
- Easy Digital Downloads – How to use hooks correctly?
- do_action not working in loop
- Updating a related post’s “post_modified” value
- adding wordpress yoast SEO canonical url from “transition_post_status” hook
- Cookie cant be read even cookie is present
- How to create callback function which returns all posts with specific data?
- How to trigger click events using hooks
- remove_action() hook not working
- Why the post ID is 0 in a hook within wp_insert_post_data?
- Function Hooked on Init Running Multiple Times
- How to work with hooks and Posts to posts plugin?
- template_redirect and title
- When is get_currentuserinfo() needed?
- disable publish button until condition is not met
- How do I remove an action hook by s2member
- How do I change TinyMCE button “i” to create a i tag rather than em? [duplicate]
- How can I modify the code generated for a PDF by the Add Media button in Classic Editor?
- Do New_to_publish hooks work for custom post types
- Creating my own “recent blog posts” static Gutenberg block, can’t use react hooks in the frontend
- How do I set a custom post type Category after import using wp_set_post_terms
- Hooks to trigger a callback when adding, removing, rearranging or updating a widget in the widget area
- Why does before_delete_post run when opening a post in the backend?