New answers tagged


I have slightly modified the code posted as answer by @Sally CJ to work with multiple cases: public function __construct() { require('pxMagAdminPlans.class.php'); require('pxMagAdminPromo.class.php'); $this->admPlanObj= new pxMagAdminPlans(); $this->admPromoObj= new pxMagAdminPromo(); add_action('admin_menu', array(...


If I understand it correctly — you want the "Plans" sub-menu to be highlighted when on the "Add/edit plans" (pxmag-plans-edit) page, then you can do it like so: Use the add_menu_classes hook to highlight the pxmag-menu menu: function my_add_menu_classes( $menu ) { // Do nothing if not on the "Add/edit plans" page. ...


Am I using this hook incorrectly No, you're not. is there another way to get the ID? Yes, try this: function add_menu_field( $item_id, $item, $depth, $args, $id ) { $id2 = 0; if ( ! $id && isset( $_GET['menu'] ) && $_GET['menu'] ) { $id2 = absint( $_GET['menu'] ); } elseif ( ! $id && ! isset( $_GET['menu'] )...


Well that didn't take long to figure out.. I've dealt with this before, but could never figure it out. Obfuscated code. Impulsively I deleted the directory, but they'll be back. If you see these weird random PHP files, your site needs to be scrubbed and relaunched from backups. Preferably XML data files with no code. Reload the entire site from sources.

Top 50 recent answers are included