What’s wrong with my $wpdb prepare?

These look like 2 separate questions. The first I think is a single vs double quotes issue: Try this: $html=””; foreach ( $recent_across_network as $post ) { $html .= ‘blog_id, ‘.$post->ID.’ ) . ‘”>’ . $post->post_title . ”; } $html .= ”; The line in the foreach is putting $post->ID in single quotes which won’t … Read more

What is _transient_random_seed for?

The wp_rand function mixes up the randomization of random numbers with various means, and in between runs it stores the random seed so as to keep the shuffling going every run. The random_seed transient is where it stores that.

Problem displaying inserted form

In your code I encountered two problems. First one is you have not defined $current_user and $abcde variable. For using global $current_user you need to define it in the top of the function as global $current_user. Otherwise it will not get the $current_user variable. And also for getting the current user ID yo need to … Read more

WP Sql query multiple where clause

You can try this with WP_User_Query instead: $args = array ( ‘meta_query’ => array( array( ‘key’ => ‘newsletter’, ‘value’ => ‘true’, ), array( ‘key’ => ‘account’, ‘value’ => ‘false’, ), ), ‘date_query’ => array( array( ‘after’ => ‘2015-01-13 00:00:00’, ‘inclusive’ => true, ), ), ); $user_query = new WP_User_Query( $args ); where I assume your … Read more

How does the WXR file differ from the WPDB?

There’s not a one-to-one relationship between the WordPress database and the .wxr file. We can find this line in the exported .wxr file: <!– This file is not intended to serve as a complete backup of your site. –> Skimming through the export_wp() function, we can see what’s excluded, for example: The data stored in … Read more

Fixing wpdb->get_results and wpdb->prepare?

As per suggestion by Milo, I removed the prepare statement, and it worked beautifully: $rs = $wpdb->get_results( “SELECT id, title, alias FROM $rs_table_name ORDER BY id ASC LIMIT 999” ); I then came to try and overwrite it through a child theme. It was being added to a filter originally in the parent theme: add_filter( … Read more

$wpdb->get_results returns empty but value exists

It is hard to say without hands on access to your data. Either the query is actually failing or the query is not something you expect in that context. You should enable error reporting via $wpdb->show_errors( true ) before it and check $wpdb->last_query for sanity after.

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