So I am developing a Wordpress(4.3.1) plugin for a customer and everything has been going smoothly until it was time to set the plugin in production.
Please bare in mind that I sadly do not have access to the server configuration, but I have been assured that the production and test servers are supposedly identical.
What we found when testing the plugin on the production server was that the plugin did not run unless a user is logged in (which is a big problem since the users of this site does not get login possibility).
I first thought it was just the filters that were not being loaded so I tried adding PHP_INT_MAX to the most important filters priority argument without any luck.
Mind you the plugin still works perfectly if you are logged in so I have figured it must have something to do with how Wordpress is handling and loading plugins.
Does anyone have good insight to issues like this because my googling has turned up resultless time after time now.
This is what my plugin load file looks like:
// First things first no access from the outside, please!
if (!defined('ABSPATH'))
exit;
// Make things easier with a proper separator
define('DS', DIRECTORY_SEPARATOR);
// Where am I?
$pluginPath = plugin_dir_path( __FILE__ );
// Add required files, thank you
require_once( $pluginPath . 'Admin' . DS . 'class-pluginAdmin.php');
require_once( $pluginPath . 'Includes' . DS . 'class-pluginUser.php');
// Instantiate OOP handlers
$ictph = new pluginUser();
$ictpah = new pluginAdmin();
/*
* Finally lets add our stuff to WP!
* This is where we define ALL short codes, actions and filters(if any)!
*/
// SHORT CODES
add_shortcode('ctp_frontpage_login', array($ictph, 'getFrontpageLink'));
// ACTION
// Add custom CSS
add_action('init', array($ictph, 'setCustomCss'));
// Create Session Handling
add_action('init', array($ictph, 'startIctpSession'), 1);
add_action('wp_login', array($ictph, 'endIctpSession'));
add_action('wp_logout', array($ictph, 'endIctpSession'));
add_action('parse_request', array($ictph, 'ictpPluginParseRequest'));
add_action('query_vars', array($ictph, 'ictpPluginQueryVars'));
add_action('admin_menu', array($ictpah, 'buildAdminPanel'));
// FILTERS
add_filter('the_content', array($ictph, 'addLoginToContent'), 20);