How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?
How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?
How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?
I have found the solution to my question and I share it. I hope someone else will find it useful in the future. I am not a developer and surely the code can be improved, but this one worked for me for what I wanted. I needed to show a list of posts ordered by … Read more
With some assistance from @JacobPeattie I modified the code to the recommended get_tags() function. Now in the functions.php I have the following code. // Get al the tags with published post function get_all_tags(){ $posttags = get_tags(”); if ($posttags) { foreach($posttags as $tag) { echo ‘<li><a href=”#”>’.$tag->name.'</a></li>’; } } } In the single.php file, I call … Read more
You can use the variable $current_post, something like this. <?php $query = new WP_Query(array( ‘post_type’ => ‘custom_job’, ‘showposts’ => 12 ) ); ?> <?php while ($query->have_posts()) : $query->the_post(); ?> <?php if ($query->current_post % 3 === 0) :?> <?php $numbers = array(‘One’, ‘Two’); //add the rest ?> <div class=”jobs<?php echo $numbers[floor($query->current_post / 3)];?>”> <?php endif;?> <div … Read more
Sounds like you’re trying to do it the old and hard way. When you add a fresh install of WordPress, it will ask you for the database information. You would need to create a mySQL database, set a user for that database, and then import the contents from the old database to the new one … Read more
No, there isn’t. WordPress does not provide page caching mechanisms, and has no APIs for it. There is no generic way to say example.com/page is now stale and needs recreating. Nor is there any generic way to pre-generate every page short of visiting them all. Every plugin uses a different solution with different APIs and … Read more
You can use this following query to get the total number of orders. $order_totals = apply_filters( ‘woocommerce_reports_sales_overview_order_totals’, $wpdb->get_row( ” SELECT COUNT(posts.ID) AS total_orders FROM {$wpdb->posts} AS posts LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID=rel.object_ID LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) LEFT JOIN {$wpdb->terms} AS … Read more
Assuming that you have an array of post objects in $my_posts… $authids = array_unique(wp_list_pluck($my_posts,’post_author’)); What you will get are the post authors for the current page of posts, not the post authors for all of the posts. If you want the authors for all of the posts you will have run another query. To run … Read more
While you might not want / be able to use native query, it is still the easiest and most reliable way to generate SQL like that. $wpdb->last_query will remember last query performed and defining SAVEQUERIES constants will make $wpdb->queries contain all of the queries performed in current load (not advisable in production for performance). So … Read more
As @Pieter Goosen said, you shouldn’t be using query_posts, nor running your own query. Instead, override the main query that already runs: function wpse_144974_pre_get_posts( $wp_query ) { if ( ! is_admin() && $wp_query->is_main_query() && is_home() ) $wp_query->set( ‘cat’, 1 ); } add_action( ‘pre_get_posts’, ‘wpse_144974_pre_get_posts’ );