Tag Info

Hot answers tagged

10

WordPress, by default, does a form of "Object Caching" but its lifetime is only a single page load. Options are actually a really good example of this. Check out this answer for more info. The summary: A page starts All options are loaded with a simple SELECT option_name, option_value from $wpdb->options statement Subsequent requests for those options ...


8

When and how to use transients or the object cache is a bit tricky and site-dependent. Here's the breakdown: When not using a persistent object cache (like memcached): Transients are stored in the database Objects in the object cache are only cached for the duration of the page request. When using a persistent object cache (like memcached): Transients ...


7

Catching the weather API remote data The msg, you're showing in your question is basically the result from the weather API. And it says, that there's no data available for your location. The first thing you want to do is some research in the Codex and the "WP HTTP API". The right/WP way to grab remote data After you've learned about the WP HTTP API, ...


6

Yes, social counts are a great use case for using transients. Aside from the slow page loading, as you mentioned, this will also help prevent you from blowing through API limits if the external requests are being made on every page load. Let's say you have it set to cache for 30 minutes and the check for cache expiration is occurring when the data is ...


5

I would not be storing 50+ meg as a transient. I would look into storing it in the filesystem somehow, or creating my own specific db table to store the data. Consider that if you're storing the transient in the database, then every time you pull it, that's 50 meg of data that has to be sent from the DB to the webserver for processing. And that's 50 meg of ...


5

For development I would advise to always work with WP_DEBUG set to true and do the following: $key = 'transient_key'; if( !WP_DEBUG && ( false !== ($transient = get_transient($key)) ){ /* Generate transient manually */ $expiration = 24*60*60;//How long to keep for set_transient($key,$transient, $expiration); } In general - it should be ...


4

take a look at WordPress Transients API which offers a simple and standardized way of storing cached data in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted. The transients API is very similar to the Options API but with the added feature of an expiration time, which simplifies the ...


3

Wordpress can be a resource hog if you don't use caching. W3 Total Cache could help you a lot with MySQL, Object and Page Caching. You should also install PHP-APC and use it with the plugin. It can do wonders.


3

Although both of your options (that is, using transients or using a cron job) are viable, I'm a fan of using transients unless the dataset is exceptionally large or if there is some need to automate the process. Without seeing much of your current code, it's difficult to give a working example. Nonetheless, if you end up going the route of transients, I'd ...


3

The problem is not with the 'transients' function. That looks like an error message returned from your third party API. You probably need to check that before you use set_transient. set_transient will insert whatever it is given and get_transient will retrieve whatever is in the DB. In other words, I am fairly sure the problem is not where you think it is. ...


3

You should not cache anything in the admin so your examples are correct. A typical nginx reverse proxy cache is set to ignore wp\-.*\.php|wp\-admin Another option is to not cache logged in users by checking the wp cookies, but you probably don't have that level of control. ps. It is highly advisable you test this out before flipping the switch. tl;dr You ...


3

I recommend you to read this article W3 Total Cache -Plugin: The Complete Settings Guide, it's a great tutorial to manually setup your w3tc. And when you saving your settings remember to flush your cache because if you don't Google Pagespeed will test it on the old cached files.. You can try to add this .htaccess rules: ## EXPIRES CACHING ## <IfModule ...


3

What permissions should I set on each of wp folders? Users will need to upload various assets (images, pdfs, office docs, audio, video). I found this article here that seems helpful, but would like to get some input from folks having done this? This will be the same as any other web server. Whatever user happens to be running the web server need ...


3

I find that W3 Total Cache works well for me in doing minifying and gzipping. (I'm not sure about the others.) More generally, if there's a plugin that does something, I use the plugin. It's very rare to see a do-it-all theme do something better than a specialized, single-function plugin, particularly when that plugin is of the caliber of W3 Total Cache.


3

Another solution would be to use an ordered list. $my_query = new WP_Query($args); if ( $my_query->have_posts() ) : echo '<ol style="list-style:decimal">'; while( $my_query->have_posts() ) : $my_query->the_post(); echo '<li><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></li>'; ...


3

Transient API works in WordPress out of the box and does not require any plugin. However installing special object cache drop in can change it's back-end implementation. Typically for keeping data in memory rather than database and improving its performance. Like rainbows and unicorns. "against" is not clear in your question. No. Full page caching plugins ...


3

there are 4 cache types that I know of Trivial - It is always on and takes affect before any other caching comes into play. It stores the cached items in an php array which means that it consumes memory from your php execution session, and that the cache is emptied after php execution is over. i.e. even without using any other cache if you call ...


3

The basic rule of thumb for Memcached is: use it if you're running multiple servers or connecting to multiple databases for the same assets. Another more harsh way to put it: If you don't know what Memcached is, you probably don't need it. Since you have a single server(and probably single DB) you won't be able to take advantage of several Memcached ...


3

Is this ok or should I just store it in an array form so I can just directly access it without using json_decode? In your case store it directly means store it serialized. Because $data is an array and cannot be stored as is, but converted to a string. Even if you access it directly like: $data = get_transient('amazon_items'); print_r( $data[0] ); ...


2

There are rewrite rules involved, so I believe the order does indeed matter. Your suggested order looks correct.


2

Read the WooCommerce docs. I've run in to this before, and the following pages cannot be cached: Cart My Account Change Password Edit Address View Order Checkout Pay Order Received


2

Did you already try adding all the mobile user agents to the "Rejected user agents" list in w3tc? I use this list for this purpose (not created by me and certainly not complete but enough for my purpose): iphone ipod ipad aspen incognito webmate android dream cupcake froyo blackberry9500 blackberry9520 blackberry9530 blackberry9550 blackberry9800 webos ...


2

For my WordPress testimonials widget plugin I've successfully used transients with expiration dates to drop page loads by 0.1 to 0.5 seconds. Using WordPress's own transients is a life-saver. It's so much easier to package or use straight as needed and then concentrate again on application logic. Rolling yet another caching system is useless. Further, as ...


2

You get as much control as any other plugin. if you need some code to be executed before any other you can't just include it in the theme and you will need the user to manually install it. Those files are reffered to "dropin plugins" and that is the best documentation I could find http://wpengineer.com/2500/wordpress-dropins/ (shame on the codex for not ...


2

wp_nav_menu() doesn't return anything by default, it just echoes out formatted html. For wp_nav_menu() to return a value you will need to pass 'echo' => false into it's arguments, like so: $housemenu = wp_nav_menu( array( 'menu' => '', 'menu_class' => 'sf-menu', 'menu_id' => 'nav', 'walker' => new description_walker(), ...


2

Assuming you have shell access, or access to any Linux/Unix box, you could use wget to download the entire site to static html files: wget --recursive --no-clobber --page-requisites --html-extension --domains domain.com http://domain.com Then either upload or move these files to your web root (after backing up and removing your WP installation). I imagine ...


2

I find that relying on the filesystem to cache results is easy for maintenance, diagnostics, and performance. Please note that this might be true in some (maybe even most) circumstances, but not all of them. If your code is meant for anything beyond personal usage you don't know with which file system and hardware will it be used and how will it perform ...


2

In short yes ... I'm using it on my own multisite with about 7 subsites and its working fine. If you have many users, then this probably a good choice as it can be activated per blog. It also has a great deal of integration for CDN, minify and and control over the caching headers.


2

We use it with great success with about 2 million page views of traffic monthly and it relieves a great deal of stress from our servers. As others have mentioned, its configurability is also a plus allowing you to control which sites use it or not. Our experience is using IIS so your mileage may vary if you're using Apache or ngix


2

It looks like your site is doing a lot of processing when displaying a page. have you tried adding a caching mechanism? you can give plugin a try: http://wordpress.org/extend/plugins/w3-total-cache/



Only top voted, non community-wiki answers of a minimum length are eligible