Read POM theme settings safely
Use the public setting helpers instead of reading options, generated PHP files or framework storage directly.
pom_get_theme_mod()
$value = pom_get_theme_mod( 'setting_name', $fallback );
$child = pom_get_theme_mod( 'group_setting/child_key', $fallback );
$color = pom_get_theme_mod( 'palette_reference_setting', '', true );
Signature:
pom_get_theme_mod( string $theme_mod, mixed $default = false, bool $hex = false ): mixed
Behavior:
- reads the request-level POM theme settings cache;
- falls back to the theme default when the value is absent;
- supports
parent/childaccess for array settings; - resolves a palette reference to its hexadecimal value when
$hexistrue; - applies WordPress's
theme_mod_{$theme_mod}filter to the final value.
Use an explicit fallback that your integration can render safely. An empty string and false are not interchangeable when the setting controls visibility.
pom_get_default()
$default = pom_get_default( 'pom_custom_color_1' );
This returns POM's registered default for a known key or false when no default exists. It is useful for explaining or comparing the shipped default; normal rendering should usually call pom_get_theme_mod() so the saved value wins.
Framework-backed settings
Some newer settings areas are owned by POM Framework instead of the legacy theme-mod cache. When a public product helper exists, call that helper. If an extension genuinely needs a framework value, use the documented POM_Framework_Settings::get_setting_value() contract from POM Framework rather than reading wp-content/settings files.
Multisite
Always execute the read in the intended blog context. Do not cache one site's theme value in a network-global key. If code uses switch_to_blog(), pair it with restore_current_blog() and avoid leaking the switched context through an early return.
Do not
- call
get_option()for a guessed POM key; - include generated settings files;
- depend on the array shape of an undocumented repeater;
- write through a read helper;
- output a value without context-appropriate escaping.