Hi there,
I have a couple of TV series sites using WP, but want to ...
-
Easiest way to mass-edit all posts?
Hi there,
I have a couple of TV series sites using WP, but want to add in some kind of feature where users can report any problems with the video, which would then be emailed to me...
Does any one have any idea how I could do this, and then easily add it to all my posts (there are too many to do manually), or if there is a plug in that would do this?
Thank you!
-
-
-
Re: Easiest way to mass-edit all posts?
no need to edit all posts, but you will have to add some php code in ur template (single post).. just an idea sir g
-
-
Re: Easiest way to mass-edit all posts?
That's very easy. Here is the script:
Code:
<?php
// AddMe.php - the simple script that adds some given html code to every published post in the WP database
// Put in into your WP root folder and simple run it once. e.g.: http://www.yourblog.com/addme.php
// Don't forget to delete addme.php from your server when done! And do not run it twice!
// Written by http://www.CyberSEO.net
define ( 'TO_ADD', '<p>PUT HERE SOMETHING YOU WANT TO ADD</p>' );
include ("wp-config.php");
$wp_upload_dir = wp_upload_dir ();
$query = "SELECT ID, post_content, post_excerpt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post'";
$posts = $wpdb->get_results ( $query );
echo 'Addding. Please wait...<br />';
foreach ( $posts as $post ) {
$post->post_content .= TO_ADD;
$post->post_excerpt .= TO_ADD;
wp_update_post ( $post );
}
echo 'Done!<br />';
echo 'Don\'t forget to delete addme.php from your server!';
?>
Last edited by CyberSEO; 08-09-2011 at 10:56 AM.
-
The Following User Says Thank You to CyberSEO For This Useful Post:
-
Re: Easiest way to mass-edit all posts?

Originally Posted by
CyberSEO
That's very easy. Here is the script:
Code:
<?php
// AddMe.php - simple script that adds a given html code to every published post in the WP database
// Put in into your WP root folder and simple run it once. e.g.: http://www.yourblog.com/addme.php
// Don't forget to delete addme.php from your server when done! And do not run it twice!
// Written by http://www.CyberSEO.net
define ( 'TO_ADD', '<p>PUT HERE SOMETHING YOU WANT TO ADD</p>' );
include ("wp-config.php");
$wp_upload_dir = wp_upload_dir ();
$query = "SELECT ID, post_content, post_excerpt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post'";
$posts = $wpdb->get_results ( $query );
echo 'Addding. Please wait...<br />';
foreach ( $posts as $post ) {
$post->post_content .= TO_ADD;
$post->post_excerpt .= TO_ADD;
wp_update_post ( $post );
}
echo 'Done!<br />';
echo 'Don\'t forget to delete addme.php from your server!';
?>
Perfect, thank you! So then I'd just need to enter some HTML code that will allow the email submit?
-
-
Re: Easiest way to mass-edit all posts?
Not sure if this helps, but I did something similar last night, with help in this thread
/blogging/339548-adding-affiliate-ads-wordpress-site.html
-
-
Re: Easiest way to mass-edit all posts?
Yes, you have to put it here:
define ( 'TO_ADD', '<p>PUT HERE SOMETHING YOU WANT TO ADD</p>' );
Then simple save the script as addme.php, upload it to your WP root folder and run it once, e.g.: http://www.yourblog.com/addme.php
Remove the script from server when done!
-
-
Re: Easiest way to mass-edit all posts?

Originally Posted by
CyberSEO
Yes, you have to put it here:
define ( 'TO_ADD', '<p>PUT HERE SOMETHING YOU WANT TO ADD</p>' );
Then simple save the script as addme.php, upload it to your WP root folder and run it once, e.g.:
http://www.yourblog.com/addme.php
Remove the script from server when done!
Thanks, really appreciate that! I don't know HTML but I think there are plenty of sites that can give me the code for this email submit thing anyway!
-
-
Re: Easiest way to mass-edit all posts?
I don't think you can mass edit all posts, you have to do that manually. But you can mass perform a single action on all of them.
-
-
Re: Easiest way to mass-edit all posts?
As the previous guy said, just edit the template.
But if you want to add something to all posts, try exporting the database in phpmyadmin as a text file. Use a good file editor to add your desired code at whatever marker signifies the beginning, or end, of a post. Then import the text file into the database again. Remember to backup before you attempt this though.
-
Similar Threads
-
By soctal in forum Blogging
Replies: 2
Last Post: 02-24-2009, 06:25 PM
-
By jkhan in forum Black Hat SEO
Replies: 0
Last Post: 01-15-2009, 04:15 PM
-
By gorgonite in forum BlackHat Lounge
Replies: 1
Last Post: 12-24-2008, 05:57 AM
-
By ArtfulWebSites in forum Forum Suggestions & Feedback
Replies: 2
Last Post: 09-21-2007, 03:35 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks