$wpdb->insert() returns false which I've learned means that the insert failed. Now, I would like to know why it fails with the insert.
According to this ticket https://core.trac.wordpress.org/ticket/32315
global $wpdb;
$custom_post_type = 'post'; // define your custom post type slug here
// A sql query to return all post titles
$results = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_title FROM {$wpdb->posts} WHERE post_type = %s and post_status = 'publish' OR post_status
I'm running wp multisite and using ACF custom field (user edit) for my local avatar, in my functions.php i added :
add_action('get_avatar', 'tsm_acf_profile_avatar', 10, 3);
function tsm_acf_profile_avatar( $avatar, $id_or_email, $size, $default, $alt ) {
$user = '';
// Get user
I have a shortcode in my WordPress page with which I access the WordPress database with wpdb.
It works perfectly with wpdb-> get_results () and wpdb-> query (), but I am not able to execute an insert with a blob data.
With wpdb:: insert I can't as it only accepts a string, int
I'm not crazy familiar with WPDB or SQL in general but I have a custom table for my project and I'm trying to assign some metadata to it. What I'd "like" to happen is if a row exists, update it and if not insert it. I've read both Insert and Update in the WPDB Codex but neither really went into a
I have a post and i need to update its post_parent. So i have used following to update the post_parent value. Old post_parent is 844 and using query i have updated the value to 370 using below:
global $wpdb;
$table_name = $wpdb->prefix . "posts";
$add_plan_to_team =
I found this code on a website which works fine for filtering data from two different select box but I have totally five comboboxes. I want to extend this functionality to work for the other three select options. Please someone help. Thanks in advance.
enter code here
$(document).
My application has >10 user_roles, each able to perform completely different tasks, provided with an custom backend and no access to wp-admin.
The extra functionality each user_role gets to use is handled via multiple plugins. Each user_rol
I'm having troubles with the mysqli driver used by wordpress, where it is converting each and every integer value to a string within $wpdb->get_results("SELECT...").
I know that it is possible so use the the option MYSQLI_OPT_INT_AND_FLOAT_NATIVE with the mysqli drive