Articles of database

Remove empty rows from the database

I’m writing a script to alter the post content column in the database and I just notice it has a lot of empty rows, these seem to be deleted posts that now have no content or anything, I don’t like them. Could i just DELETE from posts WHERE content = ”; without breaking anything? The […]

What might be the reason of Couldn't fetch mysqli_result on another domain?

I’m developing a plugin and it works fine on my WordPress website, but I’ve tested it on other domains with different WordPress instances. When trying to activate the plugin on some other sites and then on every single page of that site with no other plugins active it throws the following error: Warning: mysqli_free_result(): Couldn’t […]

How to get product order by two custom taxonomy in wordpress

Yesterday i stuck in the middle of code that how could i retrieve product belong to specific custom taxonomy ordered by other taxonomy. Table wp_posts: id | post_title ———————- 2 | Galaxy S4 4 | Iphone i5 6 | Nokia lumia 535 Table wp_term_realtionship:- object_id | term_taxonomy_id —————————– 2 | 12 4 | 12 6 […]

Changing order of db results when encoding to JSON

There is probably a very simple solution to this but I just can’t work it out. I am getting some info from the wp database, bypassing WP’s built in classes, then echoing the results as encoded JSON data like this : $db = new PDO(‘mysql:host=localhost;dbname=dbname’, ‘dbusername’, ‘dbpassword’); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = ‘SELECT user_login AS name, […]

How do I make this Metabox show current DB value?

<p> <?php $options = get_option( ‘city’ ); $names = explode( PHP_EOL, $options ); ?> <label for=”City” class=”timeshare-row-title”><?php _e( ‘City:’, ‘timeshare-textdomain’ )?></label> <select name=”city” id=”city”> <?php foreach ( $names as $name ) { printf( ‘<option value=”%s” selected=”selected”>%s</option>’, $name, $name ); } ?> </select> </p> Save function: if( isset( $_POST[ ‘city’ ] ) ) { update_post_meta( $post_id, […]

How do you render posts from outside wordpress?

I’m trying to display posts outside of the wordpress system (another system is pulling from the mysql database). However, the posts stored in the database seem to be void of <p> tags and different from what was entered in text mode (or visual mode). For example, entering this in the editor <h3>Subheadline</h3> <p>Sentence here with […]

Installation question

I am a brand new developer to wordpress and about to begin work on a client’s website that is already up and running. The site is very simple, it is more-or-less just a brochure with very little use of the database (only for customer reviews which at the moment only has about 5 reviews) My […]

WordPress security

I created a website for my customer via wordpress and I uploaded it in their server ..we assume the user have the access in the whole server ..is it possible to protect this website from being used in other server by protect editing admin password in database or adding a script that required my permission.

Directly editing WP database issues

I’ve been struggling with this for a long time and would appreciate some help. I would like to change a value inside WP database using phpmyadmin. Sadly, this change seems to corrupt the database (some things do not work anymore) when the field value has a specific form. I explain: I want to change a […]

Can't update database after wordpress update from 3.8.1 to 4.4.1

I have just updated wordpress 3.8.1 to 4.4.1. Tried to update in various ways: Before updating I have deactivated all the plugins and switched to the default theme provided by wordpress i.e. twentyfourteen. Option 1: Update wordpress automatically. Files are updated successfully as I can the see the message. But it keeps loading with the […]