Call to protected TGM_Plugin_Activation::__construct() from invalid context
'. Help!Class TGM_Bulk_Installer not found
'. Help!Follow the Installation and Configuration Instructions.
If you already use TGMPA in your theme or plugin and want to upgrade to a newer version, follow the instructions below:
class-tgm-plugin-activation.php
with the new version.example.php
file which is included in the release for new or changed options and code and adjust your existing function accordingly if necessary.
The following page will always contain up-to-date information on the current configuration options.If your theme or plugin no longer needs TGM Plugin Activation (TGMPA) support, then these are the steps you need to take to remove TGMPA. Some initiative may be needed depending on how the theme or plugin author has added it in, and it is assumed you are comfortable editing PHP files / FTP as needed.
tgmpa(
or tgmpa_register
in your theme or plugin (other than the TGMPA class file), so search for that. The registration function may be with other code in functions.php
, init.php
or a separate file such as include/tgmpa.php
or other file.require_once()
call that references the TGMPA class file:
The file name is almost certainly unique, so search your theme or plugin for that. The theme or plugin author may have used require
, include
or include_once
instead of require_once
, and they may have added extra ( )
around the file path.class-tgm-plugin-activation.php
file (or equivalent if renamed) can be deleted from your theme or plugin.With the plugins registration, the class file reference, and the class file itself all removed, your theme or plugin will no longer be using TGMPA.
If you are submitting a theme to wordpress.org or to a commercial theme repository, such as ThemeForest, your theme will be reviewed before being accepted and the Theme Check plugin is one of the tools used during these reviews.
Typical review feedback which you might see if you include TGMPA is:
REQUIRED: path/to/class-tgm-plugin-activation.php. Themes should use add_theme_page() for adding admin pages.
WARNING: More than one text-domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs. The domains found are your-text-domain, tgmpa
Solution: To fix this, download a fresh copy of TGMPA using the Custom Generator and indicate your distribution channel to get the correct version which will pass the Theme Check rules.
With older versions of TGMPA you might also encounter the following feedback from Theme Check:
WARNING: Found a translation function that is missing a text-domain. Function _n_noop, with the arguments …
REQUIRED: screen_icon() found in the file class-tgm-plugin-activation.php. Deprecated since version 3.8.
Solution: Both these issues indicate that you are using a very old version of TGMPA and you should really upgrade to the latest version.
A last issue you might encounter if you distribute your theme via ThemeForest is feedback along the lines of:
All translated strings must be escaped.
Let us reassure you: all TGMPA output strings are escaped.
Most strings are escaped late, i.e. at the point where they are echo-ed out, as only then you know the context in which the string is used. This means you will often not find the escape call together with the translation call. This is correct and is nothing to worry about.
As TGMPA - since version 2.6.0 - comes with its own translation files, you can save the translators of your theme or plugin some work, by excluding the TGMPA strings from your .pot
file.
WARNING: Only do this if you are distributing the TGMPA translation files with your theme/plugin! In other words: do not do this if you distribute your theme via wordpress.org!
The easiest way to set this up, is by using the program Poedit. So install this first if you haven’t got it already.
.pot
file in Poedit.Catalogue
⇒ Properties
or just press the key combination Alt+Enter.Sources paths
.At the bottom of this screen you can add files or folders to be excluded when generating or updating the .pot
file:
You can either exclude a whole directory …
… or exclude individual files from parsing by the .pot
generator.
OK
and then use Catalogue
⇒ Update from sources
to update your .pot
file and the TGMPA strings will no longer be included.There may be more themes/plugins active on your WordPress install which use TGMPA. The first version of TGMPA WordPress encounters will be used. This may not be the version included in your theme/plugin.
If you or your end-user experience bugs which have been solved in recent versions of TGMPA, try and find out which other theme/plugin is installed which includes TGMPA and contact the theme/plugin author and urge them to upgrade their TGMPA version.
FYI - the loading order within WordPress is as follows:
For TGMPA 2.5 and up, you’ll see the version used displayed on the bottom right-hand side of the TGMPA page.
For earlier versions, you’ll have to check the actual TGMPA file and look for the version number in the file header. Please do keep the above mentioned loading order in mind and search your WP install to see if there are several versions of TGMPA in use and check all version numbers.
Some - especially commercial - plugins will include their own upgrade routines which may overrule the TGMPA upgrade instructions. Try deactivating the plugin before trying to update. If the upgrade works when the plugin is deactivated, the above will be the reason the update didn’t work earlier.
If the update still doesn’t work, please report this as a bug.
Updating with bundled plugins can only be done by setting a minimum required version of the plugin in the settings file - the version array key. Set this to the version number of the updated bundled plugin and things should be fine.
TGMPA cannot obtain information about the version number of bundled plugins itself, so it relies on the information you provide in the settings file to determine if there is an update.
This particular situation (only) occurs when you, as a theme developer, have a developers license for Visual Composer allowing you to distribute it with your theme.
Visual Composer - by design - looks at the Envato Market place server to see if there are updates available for the plugin. If you ship the update as a zip file bundled in with your theme, the update routine within Visual Composer will overrule your bundled update, making the update fail.
To fix this, add the below line of code to your functions.php
to disable the external updater in Visual Composer:
For more information - see the Visual Composer developers documentation.
Call to protected TGM_Plugin_Activation::__construct() from invalid context
'. Help!This issue was fixed in TGMPA v2.5.2. There are at least two copies of TGMPA active in your WP install and both of them are out-of-date. Please contact the theme/plugin authors of the theme/plugins using the old version of TGMPA and urge them to upgrade the TGMPA version they include.
Class TGM_Bulk_Installer not found
'. Help!This error has been fixed in TGMPA v2.4.2. Please upgrade your version of TGMPA or contact the theme/plugin owner using an old version of TGMPA and urge them to upgrade the version they include.