WordPress blog system search engine optimization seo all raiders approach

Source: Internet
Author: User
Tags wordpress database wordpress blog

WordPress articles, comments and so many of the data are stored in the database, so the time to build a WordPress site, the site does not need much space, and the database must be sufficient, and in the WordPress database is mainly used wp_posts table to store logs, pages, attachments, Navigation menus and other data, according to the use of the time is getting longer and more and more data piled up, thus running more and more slowly, then I am very necessary to the WordPress database for the overall optimization.
Please remember to back up the data before you optimize
Delete all log Revisions
The root of the impact of WordPress running speed is the log revision record, more than 100 articles will have more than 1000 log revision records, so this step optimization must be done, the speed effect is very obvious, execute the following SQL statement:

Copy Code

The code is as follows:
DELETE A,b,c from Wp_posts a
Left join Wp_term_relationships b in (a.id = b.object_id) left join Wp_postmeta c on (a.id = c.post_id) WHERE a.post_type = ' Revision '
Optimized wp_posts table
Inserting, updating, or deleting when writing an article will result in a different size of the record fragment, which will be done in order to defragment it.

Copy Code

The code is as follows:
OPTIMIZE TABLE wp_posts;
Delete all spam messages
This can be deleted in the background of a strip, or to MySQL execution can also be done:

Copy Code

The code is as follows:
DELETE from wp_comments WHERE comment_approved! = ' 1 ';

Remove a label that is not
Some articles deleted, but the label is still in, WordPress will not automatically delete, we manually clean it down:

Copy Code

The code is as follows:
DELETE A,b,c
From
Wp_terms as a
Left JOIN wp_term_taxonomy as C on a.term_id = c.term_id
Left JOIN Wp_term_relationships as B on b.term_taxonomy_id = c.term_taxonomy_id
WHERE (
c.taxonomy = ' Post_tag ' and
C.count = 0
);

Delete the useless Postmeta record
When the record of the article is deleted, there is also the Log Extension table Postmeta data has not been deleted, but also manually cleaned up:

Copy Code

The code is as follows:
DELETE pm from Wp_postmeta pm left JOIN wp_posts wp on wp.id = pm.post_id WHERE wp.id is NULL

In a word, the speed of the site is the site's "half-life" do not make their website too bloated, so as not to affect users visit.

PHP code copy content to clipboard

$description = "Small Remnant blog (www.exehack.net) concerned about network security, IT industry, network security articles, network resources, computer technology, network security technology, network security knowledge, Internet security knowledge, the original network security blog";
$keywords = "Pay attention to network security, website vulnerability, network security, network security technology, network security Knowledge, network security tutorial, Hacker News, server security, network security article, System security";}
ElseIf (Is_single () | | is_page ()) {
$description 1 = Get_post_meta ($post->id, "description", true);
$description 2 = mb_strimwidth (Strip_tags (apply_filters
(' The_content ', $post->post_content)), 0, 200, "...");
$description = $description 1? $description 1: $description 2;
$keywords = Get_post_meta ($post->id, "keywords", true);
if ($keywords = = ") {
$tags = Wp_get_post_tags ($post->id);
foreach ($tags as $tag) {
$keywords = $keywords. $tag->name. ", ";}
$keywords = RTrim ($keywords, ', ');}
}
ElseIf (Is_category ()) {
$description = Category_description ();
$keywords = Single_cat_title (", false);}
ElseIf (Is_tag ()) {
$description = Tag_description ();
$keywords = Single_tag_title (", false);
}
$description = Trim (Strip_tags ($description));
$keywords = Trim (Strip_tags ($keywords));
?>
<meta name= "description" content= "<?php echo $description;?>"/>
<meta name= "keywords" content= "<?php echo $keywords;?>"/>

5. Fixed link

WordPress Default fixed link is the form of www.exehack.net/?p=32, is dynamic link to the search engine is not too friendly, so need to modify.
You can easily modify the form of a fixed link by setting the-fixed link option directly. As for the choice of which link form, in fact, mainly to see a person likes.
It is recommended to choose/%postname%/form. It should be noted that fixed links to the establishment of the site at the beginning of the establishment, do not modify, change the fixed link will have a great impact on the weight of the site, even if using 301 redirect is the same, so do not modify the fixed link.

6.robots.txt

The robots.txt file is placed under the root directory, which is a crawl rule for search engine settings, which allows search engines to crawl those pages.
WordPress robots.txt Writing, you can search, and there is no standard answer, is mainly to pay attention to prohibit search engine retrieval background files can be.
can refer to the wording of this site Http://www.exehack.net/robots.txt

7.sitemap.xml

Sitemap is an XML format of the site map file, by submitting to the search engine, you can make the search engine easier to crawl your site, Sitemap is Google's first launch, recently Baidu also support the submission of Sitemap, However, there are some differences between Google and Baidu's sitemap file format.
WordPress sitemap file generation, directly using the plug-in can. WordPress plug-in installation, in the background click Add Plugin, and then directly search the installation can.
Google's sitemap plugin name is Google XML Sitemaps, Baidu is Generator sitemap.

8. Internal links

The wordpress related post plugin can be used to generate a list of related articles based on the keywords in the article, which is good for both internal links and user experience.

WordPress blog system search engine optimization seo all raiders approach

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.