Converting Posts to Pages

A while ago I added a function to one of my sites to change a set of posts from one type to another. I can’t remember exactly why, but I’ve dug it out and updated it a little, and it is tested and working. The function Place this in functions.php so that it can be … Read more

Split posts between databases

It is not doable if you want to keep around all wordpress features. Possible casualties of such configuration are search and RSS feeds, probably also category and author pages. If you go and actually create a new DB for each 1k posts then the game ends here as there is no simple way to share … Read more

Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values

If you use those custom fields only for the company tagged posts, then it’s sufficient to retrieve the custom fields without worrying about posts and tags: $tags = array(‘Professional Rating’, ‘Efficiency Rating’, ‘Referral Rating’); foreach ($tags as $tag) { $result = $wpdb->get_col( “SELECT meta_value FROM wp_postmeta WHERE meta_key = ‘$tag'” ); $avg = empty($result) ? … Read more