Skip to content
🚀 Write, edit and organize your code from your WordPress dashboard.

Code Manager Tools ​

The Code Manager Tools are available for all PHP code types through the PHP class CM_Tools.

Use CM_Tools to:

  • Get access to object constants, properties, and methods.
  • Change object constants, properties, and methods.
  • Get access to WP user info.
  • Run Code Manager shortcodes from any PHP code type.
  • Write (debug) text to log files.

Usage ​

The CM_tools class is available from the Code Manager editor.

php
$cm = new CM_Tools( $self );

$constants       = $cm->get_constants();
$constant_exists = $cm->has_constant('CONSTANT_NAME');
$constant_value  = $cm->get_constant_value('CONSTANT_NAME');

$properties      = $cm->get_properties();
$property_exists = $cm->has_property('property_name');
$property_value  = $cm->get_property_value('property_name');
$cm->set_property_value('property_name', 'new_property_value');

$methods       = $cm->get_methods();
$method_exists = $cm->has_method('method_name');
$cm->invoke_method('method_name', 'argument_value'));

$menu_slug      = CM_Tools::get_menu_slug();
$argument_value = CM_Tools::get_argument('table_name');
$full_path      = CM_Tools::get_full_path();
$admin_page     = CM_Tools::get_page();

CM_Tools::log($obj);

Run Shortcodes From Anywhere ​

With CM_Tools you can run shortcodes from anywhere.

php
CM_Tools::run_shortcode_id_from_anywhere( $code_id );
CM_Tools::run_shortcode_name_from_anywhere( $code_name );

📌 This only works for Code Manager shortcodes.