Articles of database

Cannot update custom database table row

I am trying to update a row in a custom database table by $wpdb->update();. In my opinion my code is right but for some reason my database row doesn’t update. Can anyone help me with this? I want to update a the status of a transaction in the table wp_mollie_transactions where the transaction_id is equal […]

Cannot unserialize WordPress serialized values in `wp_options` table?

I have nav_menu_options in my WordPress database as below. 284,’nav_menu_options’,’a:2:{i:0;b:0;s:8:\”auto_add\”;a:0:{}}’ I tried to deserialize this value but the result is empty string – I put a code snippet in <my theme>/function.php as below echo ‘TRY #1′.'<br>’; $v = ‘a:2:{i:0;b:0;s:8:\”auto_add\”;a:0:{}}’; $d = unserialize($v); print_r($d); echo ‘TRY #1 end’.'<br>’; echo ‘TRY #2′.'<br>’; $v =’a:5:{s:9:”engine_id”;a:1:{i:0;s:9:”300000225″;}s:15:”transmission_id”;a:1:{i:0;s:6:”257691″;}s:5:”plant”;a:1:{i:0;s:23:”Oshawa, Ontario, Canada”;}s:15:”Manufactured in”;a:1:{i:0;s:6:”CANADA”;}s:22:”Production […]

How to fetch Data in WordPress using MySQLi or $wpdb

I have custom table like this: useraw 1. id (Primary*) 2. user_ip 3. post_id 4. time I am inserting data in the table using $wpdb->insert($table_name , array(‘user_ip’ => $user_ip, ‘post_id’ => $postID, ‘time’ => $visittime),array(‘%s’,’%d’, ‘%d’) ); There are four rows I inserted using this code: id : 245 user_ip : 245.346.234.22 post_id : 24434 […]

database columns: post_title vs post_name

I changed post_title, post_contents, and post_name to allow for utf by changing collating sequence to: utf8_general_ci Then using add new post, I type for the title three Hebrew ALEFs. The post_title is in Hebrew in the database, but the post_name has this value: %d7%90%d7%90%d7%90 According to Charmap, ALEF has a hex value of 05D0. So […]

Bootstrapping WordPress MultiSite Outsite of WordPress – No $wpdb

I’m working on a plugin for a system to use WordPress as the authentication backend, so that I can use my existing WordPress users in another application. The plugin works great when running in single website mode: include /path/to/wordpress/wp-config.php global $wpdb; // SQL and code to select user and compare entered passwords I need this […]

How to find if a post with custom_field == X exists?

I need to find if a post with a custom field X equal to Y exists in a wordpress installation. Should I do it with a simple sql query or is there something build in that can help me achieve it?

Using two different DB users on one WP install

I’m curious as to whether the following is possible as there are concerns that the WP site in question may be hacked via the front end & through a plugin.. We want to have the front-end connect via a Read-Only DB user We want the admin area to have Read/Write access but have this URL […]

How to generate page content from database the right way?

I am creating many pages and store them into the database. I am first styling them and than storing them. The idea is to use page.php to check the page id and display the needed post. This is all good, but I have many pages in the website. WHich means I have to perform the […]

Single database for multiple instances

I would like to create two instances of WP on a single domain. For example, I would like and to use a single database (same comments/posts). One for production and one for development. Is this possible, and if so, how?

Query from a different database than the default

I’m making a layout for a wordpress page. The layout needs to connect to a second database (both databases are in the same domain). But the problem is, when i execute just the file it works. But when i included inside the wordpress layout i don’t get data, no errorrs, nothing The script is just: […]