I gang

i need function to make wordpress use custom tables for old posts

I have a site with about 24,000 posts and 200 posts daily and the database will get huge soon. So I plan to transfer the old posts to custom tables to reduce the database load. There's no need to show these posts on the site. I just want to keep it for search engines and avoiding sql_calc_found_rows problems. These are the three tables I have created:

wp_posts -> wp_custom_posts

wp_postmeta -> wp_custom_postmeta

wp_term_relationships -> wp_custom_term_relationships

I have transferred old posts to these tables manually using phpMyAdmin and use a function to make WordPress use my custom post table instead of wp_posts if the post does not exists in it:

prefix;

if(is_single()){

//check if the post exists in the genuine posts table

$results = $wpdb->get_results($sql,"ARRAY_A");

if($results[0]['ID']){

//if exists then return

return $sql;

}else{

//else change the query

$sql = str_replace("$wpdb->posts","{$wpdb->prefix}custom_posts",$sql);

}

}

//echo $sql;

return $sql;

}

add_action('posts_request',"custom_prefix_change");

?>

However, my old posts in this case show up with no meta and taxonomies values. because wordpress still use the the default meta and relationships tables not my cutomes tables so i need function(s) to replace the default wp_postmeta and wp_term_relationships with my custom tables i just dont know the hook or filter that i should use ..

Færdigheder: MySQL, PHP, WordPress

Se mere: want to make site, prefix search, prefix function, use case, wordpress query search, load posts, wordpress load posts, reduce sql, load posts wordpress, wordpress custom post search, wordpress search replace, sql reduce, wordpress filter post, wordpress hook, database search wordpress, sql default values, change search query, wordpress search database, php sql filter, search filter wordpress, search replace wordpress, custom function wordpress, wordpress search query, wordpress search engines, custom search wordpress php

Om arbejdsgiveren:
( 5 bedømmelser ) cairo, Egypt

Projekt-ID: #4063968

Tildelt til:

quvu2009

Dear Sir, I am here ready to help. Thanks. Best regards, Rain Solution

$40 USD på 1 dag
(19 bedømmelser)
3.9