Custom order for Mysql array

At first glance, I would think your query isn’t correct. Are you echoing out the variables to make sure they are correct? If you are setting ‘post_per_page’ => 4 and you are getting 5 posts, then something seems a bit off. Where it is a number, I believe you can leave off the quotes around … Read more

Using custom tables for old posts

a simple and Not perfect solution which will do most of the job for you is to overwrite the table names like this: function custom_prefix_change($sql) { global $wpdb,$wp; $prefix = $wpdb->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 … Read more

Migrating from PDO using SQLite to clean new install using MySQL

I found out what is wrong. The tutorial says to remove all double quotes ” and replace them with spaces or backticks `, but some values in the mentioned tables have double quotes around them. This one for example: INSERT INTO “wp_usermeta” VALUES(14,1,’wp_capabilities’,’a:1:{s:13:”administrator”;s:1:”1″;}’); So replacing that with backticks causes malfunction. Replace only double quotes around … Read more

Replacing link URL ending strings via MySQL

DISCLAIMER : Not a WordPress Developer, Just a MySQL DBA For a given table, say link_url mysql> show create table wp_links\G *************************** 1. row *************************** Table: wp_links Create Table: CREATE TABLE `wp_links` ( `link_id` bigint(20) unsigned NOT NULL auto_increment, `link_url` varchar(255) NOT NULL default ”, `link_name` varchar(255) NOT NULL default ”, `link_image` varchar(255) NOT NULL … Read more

Searching With Apostrophe

Your question isn’t much of a WordPress related question, more like a MySQL question. But I have sort of a solution in my head: You could go with a custom query and a replace on the apostrophe: SELECT * FROM `table` WHERE REPLACE( `column`, “‘”, “”) LIKE REPLACE( ‘string’, “‘”, “” ) For a combined … Read more