Tag Info

New answers tagged

1

I had the exact same issue. The problem is not one that can be fixed without modifying some code that you probably shouldn't (or perhaps writing a filter or a 'drop-in'). The issue is the CAST directive in the SQL statement. It CASTS the entire table before it does anything, with the amount of records you have, its going to take a while. Capture the query, ...


1

That is not how $wpdb->prepare works. You feed prepare a string with sprintf-like placeholders, and the appropriate replacement values. Placeholders The query parameter for prepare accepts sprintf()-like placeholders. The %s (string), %d (integer) and %f (float) formats are supported. (The %s and %d placeholders have been available since the ...


1

As @bonger said, let your filters accept a second argument, which will be the instance of WP_Query that's executing the filter, and check it is indeed the main query for an event: function single_posts_fields( $sql, $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_singular( 'event' ) ) { // Do your stuff } } ...


0

My solution to the problem: $prepare = array(); $in = implode(',', array_fill(0, count($product_ids), '%d')); foreach ($product_ids as $ids){ $prepare[] = $ids; } $prepare[] = "post"; $prepare[] = $num; $results = $this->db->get_results($this->db->prepare("SELECT ID, post_title FROM ...


2

I would use a custom query like this: $amsterdamstore_args = array( 'post_type' => 'store', // This is your custom post type 'tax_query' => array( array( 'taxonomy' => 'city', // This is your custom taxonomy 'terms' => 'Amsterdam', // The term you search for 'field' => 'name', // Check against the term's ...


1

You need a custom query and loop here, at least that's how I do it. $args = array( 'post_type' =>'store', 'taxonomy' => 'city', 'term' => 'your list here' 'posts_per_page' => 5 ); $loop = new WP_Query($args); if($loop->have_posts()): while($loop->have_posts()): do stuff here endwhile; endif; You will probably want to ...


0

Actually, you don't have to use a SQL query just some adjustments in wp_config and functions.php file in your theme. Check out this topic in Wordpress Codex: https://codex.wordpress.org/Changing_The_Site_URL


0

The simplest thing to do here is remove the: 'id' => "", from the data array. Also, to simplify your database creation, you don't need to do your get_var(), you can just change your SQL command to: CREATE TABLE IF NOT EXISTS $table_name This way you let the db handle creation of the table without the need of an extra SQL statement before hand.


0

The whole bunch of code is to replicate the process, not to give the actual code. You have to figure out how your process can be meet up with this scenario. I commented on every possible line, please see the inline comments to get proper understanding. Step #1 First of all, the first portion of your code makes a Custom Meta Box, so use the portion to make ...



Top 50 recent answers are included