Share media among different domains

I have multiple Wordpress instances that live on separate domains (not a multisite installation). Since they provide the same content in different languages I'd like to share the images among these instances. Ideally these Wordpress installations would share the same Media Library so that I have to upload the files only once and they would be available on the other site as well, even served by the same CDN and sharing the same URL. So for example I upload Image1.jpg …
Category: Web

Unable leverage Browser Caching on AWS Bitnami stack (Apache) through W3TC and Cloudfront CDN

I followed many tutorial about leveraging browser caching nevertheless I couldn't configure it succesfully, in fact GTmetric (PageSpeed and YSlow) notified me many static file that don't have a cache expire header. That's my GTmetrix result (pagespeed): I tried to find the problem looking at compatibility test on W3TC and it notified me many Apache modules missed which are required for browser caching: I followed some tutorial to enable these modules but it seems they are alread enabled, in fact …
Category: Web

Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version

While trying to fix the Render-Blocking issue on my website, I ran into a problem with the W3 Total Cache plugin on its Minify settings page. The two buttons to add JS (Add a script) and CSS (Add a style sheet) are not working, nothing happens after clicking them. The cause of the issue can be seen in the browser console error message (WP uses jQuery 1.12.4, W3TC requires jQuery <1.9) Related question jQuery(...).live is not a function options.js?ver=0.9.6:324 Uncaught …
Category: Web

How to disable cache for the content returned by a shortcode

we have wrote a shortcode that returns a different content based on a timestamp. The typical business case is: "Before the 1st of January, display "registrations will be open on the 1st of January" and after that date "register here"" Therefore, it is quite important that this piece of content does not get cached. Is there a way, from the shortcode code to indicate that this piece of content should not get cached (knowing that the cache mechanism is not …
Category: Web

How do I create a link in the WP admin bar that purges all caches (W3 Total Cache)?

I'm trying to create a link in the top admin bar with a single link to purge all caches. However, after awhile the nonce expires. How can I make this work? function add_toolbar_items($admin_bar){ global $wp_admin_bar, $current_user; if ($current_user->ID == 1) $admin_bar->add_menu( array( 'id' => 'purge-all-caches', 'title' => 'Purge All Caches', 'href' => '/wp-admin/admin.php?page=w3tc_dashboard&w3tc_flush_all&_wpnonce=ce99c46c21', 'meta' => array( 'title' => __('Purge All Caches'), ), )); } add_action('admin_bar_menu', 'add_toolbar_items', 100);
Category: Web

Changing WP Object Caching during runtime

If I an external object cache (provided by W3TC), but in specific usecases use wp_using_ext_object_cache(false) during Runtime somewhere in the middle of the WP page - Does this change during effect how WP handles Object Caching? I.e. does WP afterwards ignore the global object cache (i.e. W3TC) and therefore directly take everything from the DB instead of relying on wp_cache_set/add/get? Thanks!
Category: Web

Memcaching recurring SQL Queries

I have a highly dynamic Buddypress page with integrated WPML translation. Right now I'm optimizing a lot of things and using "Query Monitor", I found out, that there are about ~50 Queries on every page load, which are completely identical and IMHO will always (as long as the admin does not change any options / wpml translations / settings in the Backend) return the same value. I want to cache specific queries, i.e. hold the values in Memcached / Redis …
Category: Web

How can I render shortcode so that its not cached by Caching plugins?

I am developing a plugin and I don't want the output of my shortcode to be cached by popular WordPress caching plugins like W3Ttoalcahe, WPSuperCache, etc. Is there any way I can achieve that or ask my users to configure their caching plugins so that my shortcodes are rendered dynamically and its output is not cached?
Category: Web

Content-Security-Policy implementation with WordPress W3Total Cache plugin installed

Documentation about this says to avoid inline script and css Error: Refused to execute inline script because it violates the following Content Security Policy directive: What I have used so far: header('Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' https: data:'); Sample to create WordPress Nonce <?php $nonce = wp_create_nonce( 'my--custom-nonce' ); ?> <script type="text/javascript" nonce="<?php echo $nonce; ?>"> // javascript code here </script> The above approach is working for custom code written Problem Statement: Third party plugins like w3Total Cache plugin which …
Category: Web

Is this Solution for Caches vs Cookies Going to Get Me in Trouble?

I've come up with a provisional solution for a not exactly common, but far from unprecedented problem with the interaction of popular WP caching solutions with cookies, in this case the standard WP comment cookies. My solution also bears on the rarely well-defined "known users" exception to serving cached files. Whether it's usable or not, I figure that explaining it and possibly learning why it's a bad idea might be generally instructive. I've tested my method with WP Super Cache, …
Category: Web

How to add support for caching plugins for my own plugin?

Is there a generic way to support caching plugins? For example to set a flag after you update an option that caching plugins watch? For example WP Super Cache has this: function wp_cache_clear_cache() { global $cache_path; prune_super_cache( $cache_path . 'supercache/', true ); prune_super_cache( $cache_path, true ); } But I will have to add custom code for each caching plugin out there. Is there a better way to do it? My plugin has some options and prints a shortcode based on …
Category: Web

How to exclude a widget from W3 Total Cache Plugin

I am using a currency widget to show live currencies for different countries. I also use W3 Total Cache plugin and the widget data is cached. For example yesterday's prices are shown for today and I have to manually purge all caches to get the new data. Is there anyway to disable cache for certain widgets? or clear the cache every hour for that widget?
Category: Web

strange characters in wordpress website displayed for visitors

Apparently a lot of people complain that they only see random letters and characters: My biggest problem is that I can't reproduce the problem on ANY of my devices! Not on my Windows XP laptop, not on my Windows 7 laptop, not on my Android phone or my iPod Touch. It doesn't matter which browser I'm using. The only time I see the problem myself is when I try to share one of my blog posts on Google+, because the …
Category: Web

Too many index.php files running and eating up all memory

I have wordpress site installed on dedicated server. From few days I'm experiencing high memory consumption on this cpanel account and it is slowing my wordpress site Then I examined Process Manager through my WHM Account and I found many index.php processes were running and consuming all memory. Then I killed all processes of career99 account through process manager from my whm account and Memory Usage also reduced. Why too many index.php are running ?, How can I check what …
Category: Web

Google Page Speed

My website is in Wordpress so I am asking question regarding Google Page Speed here. My issue is i had completed the development of home page of existing page now when i am trying to check the score of my home page it showing me the Old list of Javascripts which i had used erlier. so how can I improve the score and remove that blocking scripts. I am using Autoptimize & W3 Total Cache Plugin to optimize. FYI Website …
Category: Web

W3 Cache redirects to front page when I press purge all caches

I migrated my site to a new server. Everything seems to be fine, but the browser is redirected to the frontpage when I save configurations in either the "W3 Total Cache" plugin or in "Duplicate post" plugin. It does save the edits, but it´s annoing with the redirect. For example when I press purge all caches from W3 Cache, it is redirected to www.mysite.com/?w3tc_note=flush_all I can´t find a solution that solves it. I tried with: define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com'); In my wp-config.php …
Category: Web

W3 Total Cache JS and css Minify folder are empty

When i enable Multisite using subdirectories function and minify file status “404” so my multisite subdirectory not working properly, because minify folder are empty /var/www/html/wp-content/cache/minify/*empty . Website: https://wahwahyar.com/hindi # BEGIN W3TC Minify cache location ~ /hindi/wp-content/cache/minify/.*js_gzip$ { gzip off; types {} default_type application/x-javascript; add_header Content-Encoding gzip; expires 31536000s; etag on; if_modified_since exact; add_header Pragma "public"; add_header Cache-Control "public"; add_header X-Powered-By "W3 Total Cache/0.13.2"; add_header Referrer-Policy "no-referrer-when-downgrade"; add_header Vary "Accept-Encoding"; } location ~ /hindi/wp-content/cache/minify/.*css_gzip$ { gzip off; types {} default_type text/css; …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.