Linked Questions

Popular Questions

I have a plugin that is using OOP and it works perfectly on my localhost but not on my Bluehost server. It does not require any dependencies other than Composer autoload (i have uploaded composer generated vendor folder and json to remote plugin folder). I know the plugin is activating because it is generating empty database entries to my wp_options. However my add_menu_page function is not generating an options page in my Admin Dashboard.

  1. I made sure that localhost and remote host are running same version of PHP (7.2+) and Wordpress (5.0.3)

  2. I have already disabled all other plugins and tried uding in twentynineteen theme so I'm pretty confident it is not due to a conflict.

  3. I have enabled debugging in wp_config and receive no errors.

  4. I have no errors in my Bluehost error log

Below is a sample of my Dashboard.php....I'm only posting it because the lack of menu option is a symptom of my unknown error but i don't think its the cause

<?php 
/**
* @package ICUPlugin
*/
namespace Inc\Pages;

use Inc\Api\SettingsApi;
use Inc\Base\BaseController;
use Inc\Api\Callbacks\AdminCallbacks;
use Inc\Api\Callbacks\ManagerCallbacks;

/**
* 
*/
class Dashboard extends BaseController
{   
public $settings;

public $callbacks;

public $callbacks_mgr;

public $pages = array();

//public $subpages = array();

public function register() 
{
    $this->settings = new SettingsApi();

    $this->callbacks = new AdminCallbacks();

    $this->callbacks_mgr = new ManagerCallbacks();

    $this->setPages();

    //$this->setSubpages();

    $this->setSettings();

    $this->setSections();

    $this->setFields();

    $this->settings->addPages( $this->pages )->withSubPage( 'Dashboard' 
    )->register();
 }

public function setPages() {
    $this->pages = array(
        array(
            'page_title' => 'ICU Plugin', 
            'menu_title' => 'ICU', 
            'capability' => 'manage_options', 
            'menu_slug' => 'icu_plugin', 
            'callback' => array( $this->callbacks, 'adminDashboard' ), 
            'icon_url' => 'dashicons-store', 
            'position' => 110
        )
    );
 }

public function setSettings() {
    $args = array(
        array(
            'option_group' => 'icu_plugin_settings',
            'option_name' => 'icu_plugin',
            'callback' => array( $this->callbacks_mgr, 'checkboxSanitize' 
          )
        )
    );

    $this->settings->setSettings( $args );
    }
    public function setSections() {
    $args = array(
        array(
            'id' => 'icu_admin_index',
            'title' => 'Settings Manager',
            'callback' => array( $this->callbacks_mgr, 
    'adminSectionManager' ),
            'page' => 'icu_plugin'
        )
    );

    $this->settings->setSections( $args );
 }

public function setFields() {
    $args = array();

    foreach( $this->settingsManagers as $key => $value ) {
        $args[] = array(
            'id' => $key,
            'title' => $value,
            'callback' => array( $this->callbacks_mgr, 'checkboxField' ),
            'page' => 'icu_plugin',
            'section' => 'icu_admin_index',
            'args' => array(
                'option_name' => 'icu_plugin',
                'label_for' => $key,
                'class' => 'ui-toggle'
            )
        );
    }

    $this->settings->setFields( $args );
}

}

Related Questions