Constants and Options

  • KPrevious lesson
  • FSearch lessons
  • EscClear search

PHP Constants

The plugin defines several constants on load.

These constants and options are the plugin’s configuration surface: version, paths, capability gates, and the stored settings. Use them when you’re integrating, debugging, or writing code that needs to behave differently when Page Blocks is present.

GT_PB_BUILDER_VERSION is the current plugin version string (e.g., “2.6.0”). Used for cache-busting asset URLs and reporting the version to the license server.

GT_PB_BUILDER_FILE is the absolute path to the main plugin file (page-blocks-builder.php). Used by the license manager for registering plugin update hooks.

GT_PB_BUILDER_DIR is the absolute path to the plugin directory, with a trailing slash. Used for including files and locating templates.

GT_PB_BUILDER_URL is the URL to the plugin directory, with a trailing slash. Used for enqueuing CSS and JavaScript assets.

GT_PB_BUILDER_OPTION_POST_TYPES is the option key string (gt_pb_builder_post_types) used to store the enabled post types setting.

WordPress Options

The plugin stores its configuration in two WordPress options.

gt_pb_builder_post_types stores the array of post type slugs that the builder is enabled for. The value can be either a flat array of slugs (['post', 'page']) or an associative array where keys are slugs and values are truthy (['post' => '1', 'page' => '1']). Both formats are supported and normalized when read.

gt_pb_builder_license stores the license data as an associative array with these keys.

  • license_key – The raw license key string.
  • status – One of “valid”, “inactive”, “expired”, or other status strings returned by the license server.
  • activation_hash – A hash returned by the license server on activation, used for subsequent verification requests instead of the raw key.
  • expiration_date – The license expiration date, or “lifetime” for lifetime licenses.
  • product_title – The product name returned by the license server.
  • activated_at – The MySQL datetime when the license was activated locally.

gt_pb_builder_license_last_check stores the Unix timestamp of the last remote license verification.

Transients

gt_pb_builder_update_info caches the latest version information from the license server for 12 hours. Contains the new version number, download URL, and metadata needed by WordPress’s plugin update system.

Post Meta

_wp_page_template is a standard WordPress post meta field. The plugin writes to this field when auto-assigning the “Page Blocks Builder” template on first builder access. The possible values set by the plugin are page-blocks-builder.php and page-blocks-full-builder.php.

Block Name

The registered Gutenberg block name is gt-page-block/page-block since 2.6.0 (the legacy marketers-delight/page-block remains registered for existing content). This is defined as a class constant GT_Page_Blocks_Builder::BLOCK_NAME.

Cron Events

gt_pb_builder_verify_license is a weekly cron event that verifies the license status with the remote server. It’s registered on plugin load if not already scheduled.

Quick answers to common questions:

How do I detect Page Blocks Builder from another plugin?

Check for the GT_PB_BUILDER_VERSION constant: defined means active, and its value gives you the version for feature detection (library and REST exist from 2.1/2.5, regions from 2.6).

Where are plugin settings stored?

In wp_options under the plugin’s option keys documented in this lesson, all autoload-conscious. Library blocks themselves are database-backed posts of a dedicated type, not options.