Renaming Saved Images In WP Robot 4

WP Robot Logo
WP Robot is a wordpress plugin that will automatically fetch content from websites, social media and RSS and post them to your wordpress website.
Beside scraping the content, WP Robot can also save the images locally. However the saved images’ file-name will remain similar to the aggregated image.


Modifying The Code

I will modify WP Robot code to save all the images to the server with the following format:title-websiteUrl-randomNumber

wp-content/plugins/WPRobot4/func.php, around line 29


$file_array[‘name’] = basename($matches[0]);


$path_parts = pathinfo($matches[0]);
$file_array[‘name’] = str_replace(” “, “-“, strtolower(get_the_title($insert))) . ‘-‘ .  str_replace(‘http://’,””,get_site_url() ) . ‘-‘ . rand(0,time()/1000) . “.” . $path_parts[‘extension’];

Changing the image file name to reflect the post title can help in terms of SEO in “images search”, since search engine has less textual clues than when doing normal searches.


Any questions? Leave your comment below!


Leave a Reply

Your email address will not be published. Required fields are marked *