Migrated site – Images have 404 error

It looks like your localhost site had WordPress installed in the root directory but your production site is in a sub-directory. You should review the instructions in the the WordPress Codex for Moving WordPress to see if you missed any steps. It describes both moving a WordPress installation from one server to another, and moving … Read more

Alt Image WordPress [closed]

Unless your theme uses some type of hook to add the logo, there is probably not a solution in functions.php. Your best bet is to look through the different PHP files in your theme to figure out where the logo is being added with no alt text. From there, ideally you would check to see … Read more

Add attribute only to first image of every post via functions.php

add_filter( ‘the_content’, ‘wpse317670_add_img_attribute’ ); function wpse317670_add_img_attribute( $content ) { $from = “https://wordpress.stackexchange.com/”.preg_quote(‘<img’, “https://wordpress.stackexchange.com/”).”https://wordpress.stackexchange.com/”; $to = ‘<img example=”example”‘; return preg_replace($from, $to, $content, 1); } This will add the example=”example” to the first image found in every post content. There is another option, without using regular expression (possibly much faster and will use less memory): add_filter( ‘the_content’, … Read more

How to fix broken media library?

Usually, the determination of the culprit involves one or more of the following: 1) Try one of the Twenty themes. 2) Disable all plugins (quickly via FTP renaming the plugins folder). If a theme, contact the theme support. If a plugin, add plugins one at a time (create a new plugins folder,them move plugin folders … Read more