New answers tagged

1

Option 1: force featured image on all posts Use the save_post hook, which runs twice per "save" action if you have revisions enabled. You can verify it's the final run by checking that there is $_POST data (it's empty the first time around). add_action('save_post', 'wpse_force_featured_image', 20, 2); function wpse_force_featured_image($post_id, $post) { ...


1

This will lock uploads to “Uploaded to this post” and will not show “All media items” or other options in WordPress media panels. Add this code to your function.php file add_action( 'admin_footer-post-new.php', 'firmasite_mediapanel_lock_uploaded' ); add_action( 'admin_footer-post.php', 'firmasite_mediapanel_lock_uploaded' ); function ...


0

I know this is very old but I still needed to solve this issue, this may have worked for new images when I used it in functions.php but I did have some issues and images becoming unusable and I also couldn't harness this to update existing images. I had about 2000 existing images I needed to go through them all and make all ofthe old big images smaller. I ...


0

Since wordpress version 4.0 there is a wordpress core function attachment_url_to_postid that "Tries to convert an attachment URL into a post ID." But these function has huge flaw cos it can't convert custom image url sizes. Almost all top answers before trying solve these problem, but all of them have a very heavy database query trying to get all existing ...


0

I found that the link setting to the media file is not at the same location anymore. There is a link icon just above the picture when a user selects the image block. After clicking on it, you have the option to link the picture to the media file or the attachment file. You just have to click on "media file" or "attachment file" or add a new URL.


Top 50 recent answers are included