Storing temporary data for a custom post type

If you’re using custom post types, i’d save those date entries as post_meta entries (http://codex.wordpress.org/Function_Reference/add_post_meta). So if your client clicks on a date, you start an ajax request to your plugin/theme file to add or remove a meta entry. you can create one meta_entry named _availability for example and save all dates there (you can … Read more

How to write update query in WordPress to expire transients

Transients are not guaranteed to use database at all. They will use object cache if it is enabled. And since there is no bulk delete in object cache API, effectively there is no reliable way to clear out transients across all possible environments. There are some performance reasons to clear them out of database (which … Read more

Custom Plugin Options Won’t Update

Did you confirm it was the transient values causing the options to not update? Here’s the WordPress function to clear transient values: https://codex.wordpress.org/Function_Reference/delete_transient An example: <?php // Create a simple function to delete our transient function edit_term_delete_transient() { delete_transient( ‘the_transient_name_to_delete’ ); } // Add the function to the edit_term hook so it runs when categories/tags … Read more

Set_Transient to end at midnight

Do you just want this lines ? $midnight_time = strtotime(‘tomorrow’) – time(); set_transient( ‘transient_name’, $transient_datas, $midnight_time); $midnight_time represent the seconds before midnight happens. You can ask your server to curl a page with a random parameter if you have cache to be sure your transient is consumed with a cronjob.

Search transients through widget

A. This is a good idea in general? I’m quite new to transients. No, not really. If your data is for display and search then it’s not really ‘transient’, is it? You should store the data properly in a more permanent place and periodically sync it. If the data from this API makes sense as … Read more

delete_transient on click inside a widget form

I assume the widget and the “Refresh now” button are shown on the front-end, yes? One option to delete a transient is to use ajax to do it. This is rather rough example, but I hope it gives you the idea what to do. You can read more about Ajax in WordPress from the codex. … Read more

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