Create a Gallery and update Post Parent of Attachment Images
Create a Gallery and update Post Parent of Attachment Images
Create a Gallery and update Post Parent of Attachment Images
After doing a bit more research I was able to figure out a way to do this, though it seems like it probably isn’t a great solution because it takes way way too long to run as it basically just loops through every post using get_post_gallery(). Perhaps there is a better way though – maybe … Read more
Restricted Attachments/Change Attachment Upload Location
After spending some time reading the documentation for WP_Query’s Order & Orderby Parameters I found the following listed parameter to almost get me there: ‘post__in’ – Preserve post ID order given in the post__in array (available since Version 3.5). Unfortunately I wasn’t using post__in but rather post_parent__in so ordering by post__in didn’t work. It wasn’t … Read more
This might do the trick! css: .media-sidebar .details .edit-attachment { display: none; } .media-sidebar .details .delete-attachment { display: none; } And this: foreach( array( ‘post.php’, ‘post-new.php’ ) as $hook ) add_action( “admin_print_styles-$hook”, ‘admin_styles_so_25894288’); function admin_styles_so_25894288() { global $typenow; if( ‘post’ !== $typenow ) return; ?> <style> .media-sidebar .details .delete-attachment { display: block; } .media-sidebar .details … Read more
You can do this in code, htaccess, or go the fastest way to get it done reliably using a redirection plugin. Here are three redirection plugins vetted by WordPress VIP: https://vip.wordpress.com/plugins/safe-redirect-manager/ https://vip.wordpress.com/plugins/wpcom-legacy-redirector/ https://vip.wordpress.com/plugins/external-permalinks-redux/ And here’s a link to the one I use on sites: https://wordpress.org/plugins/redirection/ (glance at the number of active installs 400,000+)
You have add_post_meta() and update_post_meta(), but you only need the latter: This may be used in place of add_post_meta() function. The first thing this function will do is make sure that $meta_key already exists on $post_id. If it does not, add_post_meta($post_id, $meta_key, $meta_value) is called instead and its result is returned. What you are doing … Read more
You can try the following function to insert image to a post. Note: The following function will not make the image “featured image”. It will just uploaded the image and attach it to the post. It will return the attachment id if the upload is successful function insert_post_media( $post_id, $url){ $tmp = download_url( $url ); … Read more
A quick and easy way would be to just run a search on your WordPress site on the name of the image. E.g. your-image.png. This should return a list of all the posts which have that image in it.
I think a possible solution could be following codesnippet from Mark Kaplun. To solve issues with this you could remove the http part and WordPress will/should use https instead. Because the rest of your website is working correctly I assume that further settings are correct and will do their job as wished. add_filter(‘the_content’,’wpse_217012′,1000,1); // remove … Read more