Set thumbnail from URL, by grabbing image in functions.php
Set thumbnail from URL, by grabbing image in functions.php
Set thumbnail from URL, by grabbing image in functions.php
You have to trigger a change event on your field, i.e. hrld_media_input.attr(“value”, ui.item.value).change();. This will ensure that attachment_fields_to_save will get triggered.
As i understand you have used a function like get_template_directory_uri() or a similar one for your image URLs. This way I believe you are only saving relative URL. So domain change is reflected on the URL change. If you want the images to point to the old domain then you should hard code in the … Read more
The featured image doesn’t get added to the_content(). You can show it inside The Loop with the_post_thumbnail(). If you want to add the image to the_content you can manipulate it via the filter the_content, see the example section on the codex page.
This is the right hook to do this: add_action(‘before_delete_post’, ‘delete_post_attachments’); function delete_post_attachments($post_id){ global $wpdb; global $post_type; if (!$post_type == ‘bkroadkill’) return; $args = array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ‘post_parent’ => $post_id ); $attachments = new WP_Query($args); $attachment_ids = array(); if($attachments->have_posts()) : while($attachments->have_posts()) : $attachments->the_post(); $attachment_ids[] = get_the_id(); endwhile; endif; wp_reset_postdata(); … Read more
With no native solution popping up here, I ended up writing a script that Parsed my the XML import file I had and identified problem attachments Manually download those attachments with a file extension Upload those images to a new web server Alter the appropriate link and wp:attachment_url nodes to point to the new URLs … Read more
Rather than using pre_get_posts hook, you could try a better approach which will work perfectly with parse_request hook. The code – add_action( ‘parse_request’, ‘my_cpt_parse_request’, 11, 2 ); function my_cpt_parse_request( $wp ) { if( isset($wp->request) && !is_admin() ) { $requests = explode(“https://wordpress.stackexchange.com/”, $wp->request); $request_amount = count($requests); $post_name = array_shift( $requests ); // if an attachment has … Read more
How to show post attachment image
Lots of attachments is causing slow load
Incomplete attachment page