The code for NextGEN Facebook (NGFB) is highly optimized — the plugin will not load or execute code it does not have to — and unlike most plugins, NGFB makes full use of all available caching techniques:
- Non-persistent (WP Object Cache) object caching for rendered (filtered) Post and Page content.
- Persitent (Transient API) object caching for the Open Graph and Twitter Card meta tags, social buttons widget, shortcodes and content social buttons.
Tuning the Plugin Settings
You may consider the following option settings to fine-tune the plugin for optimal performance.
- If you’ve saved a few posts and pages without any duplicate meta tag warnings, you can disable the “Check for Duplicate Meta Tags” option in the NGFB > Advanced > Theme Integration settings. This will prevent NGFB from fetching the front-end webpage when editing posts and pages.
- If your website content does not use any embedded videos, or if you prefer not to include embedded videos in your Open Graph and Twitter Card meta tags, set the “Maximum Number of Videos” to “0” in the NGFB > General > Videos settings. This will prevent the plugin from searching your content for embedded videos.
- If you want to limit which video service APIs are supported, enable/disable one or more of the “Check for Embedded Media” options in the NGFB > Advanced > Content and Filters settings.
- If you generally have a featured image for your posts and pages, you may set the “Maximum Number of Images” to “1” (the default value). This will prevent the plugin from searching your content for additional images (the featured image counts as “1” and the plugin will stop there).
- If no excerpt / summary text is available, the content text will be used to create the Open Graph description value. If your content does not rely on shortcodes or plugins to render its text, you may uncheck the “Apply WordPress Content Filters” option in the NGFB > Advanced > Content and Filters settings.
- You can increase the “Object Cache Expiry” option in the NGFB > Advanced > File and Object Cache settings from 86400 seconds (the default) to several days / weeks. NGFB removes outdated cache objects when posts / pages are updated, so increasing the default values should not create any issues.
- If you don’t use an object / transient cache (like APC, XCache, memcache, etc.) and have a website with tens of thousands of posts and pages, the creation of transient cache objects will put additional / unwanted load on your database (by default, WordPress saves transient objects to the database). Using the database for transient objects shouldn’t be a problem unless you have a preexisting database performance issue. Aside from making sure your database is running well, you should also install an object / transient cache. If that’s not possible, you may turn off one or more of NGFB’s caching features by adding the following constant(s) to your wp-config.php file:
12345define('NGFB_FILE_CACHE_DISABLE', true);define('NGFB_TRANSIENT_CACHE_DISABLE', true);define('NGFB_OBJECT_CACHE_DISABLE', true);
Start by disabling only the transient cache — the file and object caches should not affect database performance.
- If you don’t use the NGFB sharing buttons, you can disable all sharing button features by adding the following constant to your wp-config.php:
Alternatively, you may want to update from NGFB to WPSSO. WPSSO is a fork / child of NGFB — they have the same author, the same core features and code-base, but WPSSO is distributed without the sharing buttons and their related features (making WPSSO about 20% smaller than NGFB). Additional extension plugins are also available for WPSSO, including:
If you have not installed an opcode and/or transient object cache, you really should. There are many great articles on optimizing WordPress, which cover the subject of opcode and object caching. Here are a few that I’ve written (though they may be a little too technical for some). Please take the time to research opcode and transient object caching solutions – they will make a big difference to your website’s performance and maximum concurrent user capacity.
- WordPress Caching and Plugins for Performance
- Save Memory with Alternative PHP Cache (APC)
- Memcached vs Disk Cache
Full-Page Caching (Plugins or Front-Ends)
article:author value is not compatible with the Open Graph standard. Depending on the Pinterest “Author Name Format” option in the SSO > General > Pinterest settings, WPSSO may create different Open Graph meta tags for the Pinterest crawler. If you use a full-page caching plugin (for example), you should disable caching for the Pinterest crawler or save a different cached version. For example, you could disable caching for the following user agent:
If your caching plugin supports PHP expressions to generate a cache ID, you could use:
( strpos( $_SERVER['HTTP_USER_AGENT'], 'Pinterest/' ) !== false ? 'Pinterest' : '' )
Defragment the Database
The database tables in MySQL can become fragmented as entries are added/removed/updated, especially the options table which holds the transient cache entries. You should defragment you database tables at least daily. I use Phil Dufault’s
mysqlfragfinder.sh script for my own databases.
Here is an example crontab entry:
# defragment mysql tables
0 3 * * * export TERM=vt100; /usr/local/bin/mysqlfragfinder.sh >/var/tmp/mysqlfragfinder.log
And to prevent the script from stopping for a password, add an entry for it in the
And lastly, you should perform at least two types of performance tests on your website — A PHP code execution speed test using P3 (Plugin Performance Profiler), and a browser rendering speed test from the WebPageTest website (or equivalent). The first test will show you the speed penalty incurred by each active plugin. You can expect excellent results from NGFB. As an example, here are the PHP code execution speed results from P3 (Plugin Performance Profiler), using WP Test Data and the default settings of a few popular plugins:
- 0.0105 secs – WordPress Social Sharing Optimization (WPSSO) v2.5.2
- 0.0117 secs – All in One SEO Pack v2.1.4
- 0.0130 secs – MarketPress – WordPress eCommerce v18.104.22.168 (No Products)
- 0.0164 secs – NextGEN Facebook (NGFB) v7.5.2
- 0.0189 secs – Contact Form 7 v3.7.2
- 0.0322 secs – WP e-Commerce v22.214.171.124 (No Products)
- 0.0393 secs – bbPress v2.5.3 (No Forums or Topics)
- 0.0405 secs – WooCommerce v2.1.5 (No Products)
- 0.0572 secs – SEO Ultimate v7.6.2
- 0.0579 secs – Facebook v1.5.5
- 0.0656 secs – BuddyPress v1.9.2 (No Activities)
- 0.1051 secs – WordPress SEO by Yoast v126.96.36.199
- 0.1980 secs – JetPack by WordPress.com v2.9.2
Tests executed on a VPS with SSDs and 6GB ram, APC opcode/object cache, WordPress v3.8.1, P3 v1.4.1 configured with opcode optimization enabled (improves accuracy).