New answers tagged

0

Last time I used this plugin, you had to flush the entire cache to do this: add_action('save_post','custom_clear_wp_super_cache'); function custom_clear_wp_super_cache($post_id) { if (function_exists('wp_cache_clear_cache')) {wp_cache_clear_cache();} } There may (or may not) be a method of flushing the cache for a particular post now.


0

There is simple solution for that. You need to check if editor is active then set value of editor otherwise set value of text-area.See bellow code. if(tinyMCE.activeEditor==null) { jQuery("#txtArea").html('your html'); } else{ tinyMCE.get('txtArea').setContent('Your html'); }


11

Object cache everywhere WordPress tries to reduce the number of database queries as much as possible. For example, anytime you get a meta field or a taxonomy field, before querying the database, WordPress looks if that that was already queried and stored in cache, and returns it from there instead of querying the database. The "cache job" is done via ...


3

The main point of interest here is the update_post_caches function. It is called after WP_Query got all the posts from the DB. Usually, the reason you want the posts in the first place is to display them which usually means to display the terms and something based on the metadata, therefor WP_Query will also by default query the DB for the meta and term data ...


1

The previous answers have already highlighted the obligatory "It depends.", to which I fully agree. I would like to add a recommendation though, based on how I "suppose" this would be best done in the scenario you are describing above. I would not use Transients in that case, but rather Post Meta, because of one advantage that the latter has: Control. As ...


9

Not All WP Code Is Public Code If you are going to release something public, then all the things kovshenin said are perfectly valid. Things are different if you are going to write private code for yourself or your company. External Object Cache Is A Big Benefit, In Any Case To set a external persistent object cache is very recommended, when you can. All ...


14

Should I use Transient API at all here? No. In a stock WordPress install transients are stored in the wp_options table, and only cleaned up during core upgrades. Suppose you have 50,000 posts, that's 50,000 additional rows in the options table. Obviously they're set to autoload=no, so it's not going to consume all your memory, but there's another ...



Top 50 recent answers are included