WordPress REST API, Expired Nonce from Cache results in 403 forbidden

My wordpress site sits behind Akamai, which is a cacheing service similar to Cloudflare. I make the following API call: GET /wp-json/mytheme/v1/get-posts?post_type=videos This is done using apiFetch from ‘@wordpress/api-fetch’; And it automatically includes this in the request header X-WP-Nonce: 12323423 This works fine until 24 hours later, when the nonce expires. The cache still continues … Read more

Cache Get_posts

I have a query (see below) that gives a list of 10 news items ordered by the meta value “event_date” and filtered so that only posts earlier than today are displayed. This query is taking two seconds to process, so I am looking for a simple way to cache the results to get the load … Read more

posts_per_page doesnt work

Here is the my custom query ; <?php $Poz = new WP_Query(array( ‘posts_per_page’ => 3, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘no_found_rows’ => true, ‘update_post_term_cache’ => false, ‘update_post_meta_cache’ => false, )); // The Query $the_query = new WP_Query( $Poz ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/70424/<?php the_permalink(); ?>” title=”<?php … Read more

W3 Total Cache plugin integration

I am working on a plugin (widget) that is using some transients that are updated from time to time. That said, when these transients are updated, I think I will need to flush the cache to display the new data properly. Thus, I wonder if have some way to flush the cache only for widget … Read more

Run oembed separately outside the_content()

I have this structure for my content.php : <div class=”featured”> <!–featured image here–> </div> <h1 class=”entry-title”>Post Title</h1> <div class=”entry-content”> <?php the_content(); ?> </div> I would like to move the first oEmbed in the_content() to the area enclosed by .featured such that the title will appear after the media content. I have come across these few … Read more

How to purge all transient caches?

Is there an easy way to delete all transient caches? A plugin maybe? Or like in drupal “drush cc all”? 3 Answers 3 Not tested, but if you need a quick and dirty way, you could put a script like this in your WordPress folder and call it each time: define( ‘WP_USE_THEMES’, false ); require(‘wp-blog-header.php’); … Read more