Modify WordPress SQL Query to pull from within a category

You need to make sure that the $currentcat variable is set before this query runs. This should be the id of the category you want to pull top posts from. $sql = “SELECT count(mr.post_ID) AS totHits, p.ID, p.post_title FROM $wpdb->posts p JOIN {$wpdb->prefix}kf_most_read mr ON mr.post_ID = p.ID JOIN {$wpdb->prefix}term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE … Read more

Importing Geo data into wordpress database

To answer your question… Yes, it’s doable. But to give you some pointers into the right direction… I’ve known some folks who have had good success using the WordPress Importer plugin. You could conceivably export your geo data from your database (using whatever DB management tool you’re comfortable with) to the import format that this … Read more

Export / import WordPress database

I normally use mysqldump and sed: on old server: mysqldump -u user -p OldWpdatabase > wpdb.sql sed -i ‘s/oldurl/newurl/g’ wpdb.sql on new server: mysql -u user -p NewWpdatabase < wpdb.sql sed is used to search and replace all the hard coded occurrences of the website if needed.

Optional Meta Query

All of the real work here is being done by $geoDataStore->getPostIDsOfInRange. That is where the search is done and that is what isn’t returning the results you want. WP_Query just pulls the specified post IDs. There is no reason you should have to abandon that part of the code, though you may want to add … Read more

Confused by $wpdb->prepare

First, prepare() allows you to specify two different types of data: %s for String Types %d for Integer/Numeric Types The reason is simple: MySQL only knows two (and a half) data types: Strings and Numerics (and Date/Time). So this way you specify what type it is and make sure only that type gets trough. Still … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)