1. Home
  2. Docs
  3. 3D
  4. Backend
  5. PHP Hooks & Filters

PHP Hooks & Filters

wp3dconf/editor/after_enqueue

Fires after all editor scripts and styles have been enqueued. Use this to enqueue additional assets that depend on the editor.

add_action( 'wp3dconf/editor/after_enqueue', function() {
  wp_enqueue_script( 'my-editor-addon', plugin_dir_url( __FILE__ ) . 'editor-addon.js' );
} );

PHP Admin Actions

wp3dconf/admin/register_post_types

Fires when the plugin registers its post types. Use this to register additional post types alongside wp3dconf.

add_action( 'wp3dconf/admin/register_post_types', function() {
  register_post_type( 'my_addon_type', array( /* ... */ ) );
} );

wp3dconf/admin/register_submenus

Fires while the plugin registers its wp-admin submenu pages (under edit.php?post_type=wp3dconf). Use this to add your own submenu page.

add_action( 'wp3dconf/admin/register_submenus', function() {
  add_submenu_page(
    'edit.php?post_type=wp3dconf',
    __( 'My Addon', 'my-addon' ),
    __( 'My Addon', 'my-addon' ),
    'manage_options',
    'my-addon-page',
    'my_addon_render_page'
  );
} );

PHP Admin Filters

wp3dconf/admin/settings_fields

Filters the tab/field definitions on the wp3dconf → Settings page. Unlike a typical settings-page hook, this isn’t an action that echoes HTML — it’s a filter over the same array-based field schema the core settings themselves are defined with, keyed by tab label.

ParameterTypeDescription
$fieldsArrayTab label => list of field definitions
add_filter( 'wp3dconf/admin/settings_fields', function( $fields ) {
  $fields[ __( 'My Addon', 'my-addon' ) ] = array(
    array(
      'id'      => 'my_addon_option',
      'label'   => __( 'My Option', 'my-addon' ),
      'type'    => 'text',
      'default' => '',
    ),
  );
  return $fields;
} );

wp3dconf/editor/tabs

Filters the tab list in the configurator editor sidebar (default tabs: model_structureglobal_settings).

ParameterTypeDescription
$tabsArrayRegistered tabs keyed by tab ID, each ['name' => ..., 'icon' => ...]
add_filter( 'wp3dconf/editor/tabs', function( $tabs ) {
  $tabs['my-tab'] = array(
    'name' => __( 'My Tab', 'my-addon' ),
    'icon' => 'settings',
  );
  return $tabs;
} );

wp3dconf/editor/layer_types

Filters the available layer types shown in the “Model Structure” tab’s draggable layer list (default types: groupsubgroupoption). This is what Module_Base::layer_type() / layer_types() writes into on a module’s behalf.

ParameterTypeDescription
$typesArrayRegistered layer types keyed by type slug, each ['name' => ..., 'icon' => ...]
add_filter( 'wp3dconf/editor/layer_types', function( $types ) {
  $types['my-type'] = array(
    'name' => __( 'My Layer Type', 'my-addon' ),
    'icon' => 'edit',
  );
  return $types;
} );

wp3dconf/editor/global_settings_controls

Filters the editor’s global-settings schema (the “Global Settings” tab). This is what Module_Base::global_settings_controls() writes into on a module’s behalf — see modules/woocommerce/class-woocommerce.php for a worked example of adding an option to an existing control vs. a whole new section.

ParameterTypeDescription
$settingsArraySettings schema, keyed by section

wp3dconf/editor/layer_settings_controls

Filters the schema for the per-layer “Settings” panel shown when a layer is selected in the editor (price, sale price, description, CSS class, etc. live here by default). This is what Module_Base::layer_settings_controls() writes into on a module’s behalf — see modules/custom-fields/class-custom-fields.php‘s layer_settings_controls() for an example that adds a whole new “Field Settings” section, gated to only show for its own layer types.

ParameterTypeDescription
$settingsArraySettings schema, keyed by section
add_filter( 'wp3dconf/editor/layer_settings_controls', function( $settings ) {
  $settings['my_section'] = array(
    'name'     => __( 'My Settings', 'my-addon' ),
    'settings' => array(
      'my_option' => array(
        'name' => __( 'My Option', 'my-addon' ),
        'type' => 'text',
      ),
    ),
  );
  return $settings;
} );

How can we help?