Delete transients in website

Transient are not always deleted when they expire, and that makes them unpredictable and sometimes a pain. Whenever I work with transients, I add some kind of functionality to delete the transients when something happens, like I delete transients when publishing posts or updating them if the transient was meant to keep data related to … Read more

Transient loop issue

The reason it’s only storing the first post data is because you’re using the same transient name for each post. If you want to store multiple movie transients, you need unique names for each movie. Also, the way you’re getting the transient defeats the purpose of using transients. You want to first try to get … Read more

Transient feeds and caching error

Since you mentioned that this is only happening on certain environments then a possible cause could be that those servers do not have the proper PHP extensions installed to handle parsing XML. Here’s a great Stack Exchange answer that outlines most (if not all) of the required extensions. Specifically, I would confirm whether or not … Read more

Delete a WordPress transient from a shortcode on Page/Post update

If you will save all data of shortcodes in one variable, you can reset it easy. Example somewhere in shortcode(pseudocode): $page_cache = get_transient(“page_{$page_id}”); if ( empty($page_cache ) ){ global $shortcode_index; $page_cache[$shortcode_index] = **some data that cached**; set_transient( “page_{$page_id}”, $page_cache, **some time** ); $shortcode_index++; **** } And then you can delete it just by page_id on … Read more

Store sticky post’s ids in a transient

You can try: add_action(‘update_option_sticky_posts’, function( $old_value, $value ) { $featured_args = array( ‘post__in’ => $value, ‘post_status’ => ‘publish’, ‘no_found_rows’ => true ); // The Featured Posts query. $featured = new WP_Query( $featured_args ); // Proceed only if published posts with thumbnails exist if ( $featured->have_posts() ) { while ( $featured->have_posts() ) { $featured->the_post(); if ( … Read more

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