How to optimize wordpress website

We have many option for optimizing wordpress website. From these some of them are described below:


Catching :

We can make site fast and re bust by using catching implementation on website.


Query Optimization:

Reducing unrequired column on Post table:

WordPress framework has used simple table structure. All the post and page content are inserted in single table. The content of any page and post are putting next column for revised content of individual page. If we have maxmium of this unrequired column on table it makes effect on processing time of quering process. We need to remove this unrequired column on that table .

See below the query for getting all content in individual table and unrequired column of table in the post table.

To see how much the column in that table:

select count(*) from wp_posts

where wp_post is table name.


Find unrequired revision content on table.

select count(*) from wp_posts where post_type=’revision’



Query to remove the unrequired revision column on the table.

delete from wp_posts where post_type=’revision’










Getting Site permalink url of Associated template page by template_page_name

WordPress have the query function which filters associated template pages. If we require the page URL automatic by using template name we can use like this function to get the associate page link.

* Get the template related page url by template name
* input template name like $TEMPLATE_NAME = template-service.php
* @ returns {siteurl}/service
* Service is page slug which is created in page

function getTplPageURL($TEMPLATE_NAME){

$pages = query_posts(array(
‘post_type’ =>’page’,
‘meta_key’ =>’_wp_page_template’,
‘meta_value’=> $TEMPLATE_NAME

$url = null;
if(isset($pages[0])) {
$url = get_page_link($pages[0]->ID);
return $url;
echo getTplPageURL(template-service.php);
* Returns the associate page_url
* which is created in pages with using this template