just like that

  • Home
  • Make Money
    • Your Click
    • Others Click
    • Other Programs
  • Technical Support
    • Windows
    • Android
    • Other
      • how to do
  • online Is On
    • Online Media
      • Online Fm Radio
      • Online Tv
      • Online Games
    • Funny Videos
    • Downlaod Mp3 And MP4 Songs
    • Most Important Videos On Youtube
    • How To Make
  • Tourist Place
  • Health
    • Food Medicine
    • Workout
  • Image Collection

Wednesday, 30 November 2011

How To Edit Thousands of WordPress Posts With Just One SQL Command

 19:01     sql     No comments   


It is very interesting to maintain a WordPress blog. You have to perform a number of tasks such as getting the website designed, choosing a relevant theme and writing unique and appropriate posts to attract more traffic. But with time you realize that visitor flow to your blog is less and your web host has less bandwidth.
It takes a lot of time and effort to enhance the presence of your blog. Sometimes, there are certain major changes that need to be done.
SQL Command to edit wordpress posts

Modifying Posts With One SQL Command

There are thousands of posts in your blog in which Google adverts are inserted manually. If you want a minor editing, you have to make changes in all these posts. This is a tedious task.
However, certain tools are available which can make this process simpler. Here we discuss how you can edit a large number of posts with a SQL command. You need a phpMyAdmin to start this process. Go to the menu on the left. Select your blog’s database.
database php admin
There is a code in SQL tag. This code will be used to remove various sections of the content. It will delete the content you have selected on any number of blog posts. But the condition is that the start text and end text should be common in all the content. For example, there is a common start and end tag in Google advert.
The screenshot below displays the blog entries in which the ad is manually inserted on each page after ‘more’ tag.
ad location
The code will make your page appear like the following screenshot.
code
There is a ‘script type’ start tag which can be used before every advert. The end of the advert has a‘script src’ tag.
If you want to remove an entire block of a page, you have to use the ‘update’ command of SQL. You must understand three functions of MySQL: locate, replace and substr.
LOCATE is used to inform the SQL command about the start & end points location. Here, strings are used before and after the section. Following is the command for the location of the start point on a  page:
LOCATE (‘<script type=”text/javascript”>’, post_content)
The end point location is little complicated. You get a start for a string. In order to get the end point location, the total characters have to be added. Check out the following command.
LOCATE(‘<script src=’http://pagead2.googlesyndication.com/pagead/show_ads.js” type=”text/javascript”>’, post_content) + 93
Use REPLACE to remove the text you do not require. You need to tell the function which text is no longer required. Use SUBSTR to take out the string from your post content. You need to give details of your starting location and length.
When the code is inserted to SUBSTR function, it looks like the following:
substr(post_content, locate(‘<script type=”text/javascript”>’, post_content), ((locate(‘<script src=”http://pagead2.googlesyndication.com/pagead/show_ads.js” type=”text/javascript”>’, post_content) + 93) – (locate(‘<script type=”text/javascript”>’, post_content))))
It includes three sections: post content, length and start location.
This defines the text you wish to wipe from the posts. Now simply use REPLACE to remove it. Add the code in the command below:
UPDATE wp_posts SET post_content = replace(post_content, string_to_replace, replacement_string);
It will appear like the following:
UPDATE wp_posts SET post_content = REPLACE(post_content, substr(post_content, locate(‘<script type=”text/javascript”>’, post_content), ((locate(‘<script src=”http://pagead2.googlesyndication.com/pagead/show_ads.js” type=”text/javascript”>’, post_content) + 93) – (locate(‘<script type=”text/javascript”>’, post_content)))), ‘ ‘);
If there is proper alignment of the syntax, your phpAdmin will show successful results as shown in the screenshot below.
php admin
When the posts are reloaded in the browser, the ad will not be displayed.
ad removed
However, there are certain ads that have different formatting like the page below.
different formating
In such a case, change precise tags at the start and end. Use the SQL command again and remove the tags.
SQL command
You can delete any content in the WordPress post by using this technique. You can easily use the SQL commands for editing a large number of posts. This saves you from working manually. You must remember that a proper backup of your database has to be maintained before you begin with the process.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 comments:

Post a Comment

Video Game Godfather - Work From Home Selling Video Games Online

Click Here!

Appszero - Build Mobile Apps With Zero Coding

Click Here!

Translate

I Got Total Views

Popular Posts

  • 10 Different Url Shorteners That Give You Addon Benefits
    There was a point of time when no one ever considered the fact that there ever might arise a need for a URL shortener. In recent times, howe...
  • Create Short URLs with the Goo.gl Bookmarklet
    If you are looking for a way to create your own short URLs with goo.gl but without installing the Google Toolbar, here's a quick bookma...
  • how to avoid ads in youtube
    IT'S just simple right click select pop out thats all  
  • Top 10 Free Software Download Sites
    A computer user needs different software to meet different needs all the time. Over the years many software companies have created some a...
  • Tips and tricks for Sony Ericsson W800i and W810i
    Official Sony Ericsson Tips and Tricks http://www.sonyericsson.com/spg.jsp?cc=gb&lc=en&ver=4000&template=ps1_1_5_4&zone=p...
  • earnparttimejobs
    earnparttimejobs:-                            Indians Earn Rs.50000/month via part time jobs. Easy form filling data entry jobs Earn Rs.25,0...
  • How 2G Works
    How 2G Technology Works Advancement in mobile phones technology has been marked by generation (G). Analog phones are related to the 1st gen...
  • Live Flight Tracking on Google Maps
    Casper is a brilliant mashup that displays movement of incoming and outgoing flights on a Google Map  live . The airplanes are colored based...
  • rupyalive
    rupyalive:-                  RupyaLive.com is a unique way which helps advertisers in brand promotion and members get paid to check promotio...
  • Gemini Comedy

Recent Posts

Categories

  • 12b
  • 180
  • 365 Kadhal Kadithangal
  • 3g
  • 4 Students
  • 7am arivu video songs
  • affiliate
  • Airtel Free Live Tv
  • Audio CD/DVD Burning
  • blog tricks
  • blogging
  • browser
  • Dish tv
  • download manger
  • download soft
  • earn sites
  • facebook
  • Favicon to Blogger
  • free call
  • free sms
  • games
  • Gemini Comedy
  • google
  • gprs
  • health
  • hindi
  • How do I create a blog
  • internet
  • iPhone
  • java
  • Kavithai
  • LG
  • live mobile tv
  • live tv
  • mobile
  • mobile tv
  • motorola
  • movies
  • mp3 player
  • Nadanthathu Enna
  • Noika
  • old movies
  • online fm
  • online movie
  • online movies
  • online tv
  • Photoshop
  • samsung
  • Serials
  • software
  • sony ericsson
  • sql
  • Surya Hits
  • tamil
  • tamil movies
  • tamil video songs
  • tamilmobiletv
  • tech
  • telugu
  • top 10
  • TV SHOWS‎
  • video converter
  • Video Players
  • video songs
  • windows software
  • youtube

Blog Archive

  • August (36)
  • September (39)
  • November (715)
  • December (627)

About Me

My photo
punniyaseelan
View my complete profile
Powered by Blogger.

Sample Text

Copyright © just like that | Powered by Blogger
Design by punniya seelan | Blogger Theme by New Blogger Themes | Distributed By Templates