Multipart/formatted MySQL query problem

After much trial and error I finally figured out a solution using mysqli. I consider it a acceptable solution since the query will only be run on plugin updates. $mysqli = new mysqli(); $mysqli->connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $sql = ” DROP TRIGGER IF EXISTS {$wpdb->get_blog_prefix($site->id)}post_queue_insert; CREATE TRIGGER {$wpdb->get_blog_prefix($site->id)}post_queue_insert BEFORE INSERT ON {$wpdb->get_blog_prefix($site->id)}posts FOR EACH ROW … Read more

Slow wp_enqueue_media()

To load admin scripts only on your pages, you should use the $hook-parameter: function enqueue_scripts( $hook ) { if( ‘my-page’ != $hook ) return; wp_enqueue_script(‘jquery’); wp_enqueue_media(); // etc… } add_action(‘admin_enqueue_scripts’, ‘enqueue_scripts’); Concerning the loading problem. This seems to be still an open problem. The ticket 27985 was followed up by #32264, which is not closed … Read more

Custom query_var causes displaying posts archive on front page

After detailed debugging of WP::parse_request() and WP_Query::parse_query() I found out that unset( $query_vars[‘date’] ); in ‘request’ filter helps. It basically unsets date query var before WP_Query::parse_query() is invoked so is_home() returns false. add_filter( ‘request’, function( $query_vars ) { global $wp_query, $wp; if ( ! $wp_query->is_main_query() ) { return $query_vars; } $qv_keys = array_keys( $wp->query_vars ); … Read more

Add multiple value to a query variable in WordPress

I am giving you some solutions whatever you want to use. Using plus http://myexamplesite.com/store/?brand=nike+adidas+woodland //Don’t decode URL <?php $brand = get_query_var(‘brand’); $brand = explode(‘+’,$brand); print_r($brand); ?> using ,separator http://myexamplesite.com/store/?brand=nike,adidas,woodland $brand = get_query_var(‘brand’); $brand = explode(‘,’,$brand); print_r($brand); Serialize way <?php $array = array(‘nike’,’adidas’,’woodland’);?> http://myexamplesite.com/store/?brand=<?php echo serialize($array)?> to get url data $array= unserialize($_GET[‘var’]); or $array= unserialize(get_query_var(‘brand’)); print_r($array); … Read more

How to display Section for certain time

Check the time parameter on WP_Query Class. There is a example on how to show posts form last 30 days. You can do it for last couple of hours, minutes or even seconds! Code is tested and working. $args = array( ‘posts_per_page’ => 1, // We are showing only one post ‘category_name’ => ‘prime’ // … Read more

wordpress query – orderby child post date

You should be able to do this with the get_children function (see the codex), $ticket_id = 34; // assume you want to retried the replies of ticket post id=34 $args = array( ‘post_type’ => ‘support_tickets’, ‘numberposts’ => -1, ‘post_parent’ => $ticket_id, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ ); $replies = get_children( $args ); Assuming that … Read more

Is there any difference between hooks posts_where with posts_join and posts_search performance wise?

All of these hooks are called in a similar fashion and get passes similar data. Under normal circumstances there should be no meaningful performance difference between them. One scenario I can think of is that if you aren’t properly targeting your code to specific queries and it runs in every query then posts_search might fire … Read more

How to List Events by Year and Month Using Advanced Custom Fields?

This should get you started: <?php $the_query = new WP_Query( array( ‘post_type’ => ‘kalender_item’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘kalender_item_datum’, ‘orderby’ => ‘meta_value’ ) ); # This will hold what group we’re in $current_header=””; # The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); # get the datum for this post $temp_date = get_post_meta( get_the_ID(), ‘kalender_item_datum’, … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24eduedueduseduseduedusedueduedusedu