: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
require_once Redux_Core::$dir . '../sample/sections/disabling/disable-field.php';
require_once Redux_Core::$dir . '../sample/sections/disabling/disable-section.php';
'title' => esc_html__( 'Redux Extensions', 'your-textdomain-here' ),
'id' => 'redux-extensions',
'class' => 'pro_highlight',
'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-extensions/" target="_blank">https://devs.redux.io/core-extensions/</a>',
require_once Redux_Core::$dir . '../sample/sections/extensions/accordion.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/color-scheme.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/custom-fonts.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/google-maps.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/icon-select.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/js-button.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/repeater.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/search.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/shortcodes.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/social-profiles.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/tabbed.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/widget-areas.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/taxonomy.php';
require_once Redux_Core::$dir . '../sample/sections/extensions/users.php';
require_once Redux_Core::$dir . '../sample/metaboxes.php';
if ( file_exists( $dir . '/../README.md' ) ) {
'icon' => 'el el-list-alt',
'title' => esc_html__( 'Documentation', 'your-textdomain-here' ),
'id' => 'opt-raw-documentation',
'content_path' => __DIR__ . '/../README.md', // FULL PATH, not relative, please.
Redux::set_section( $opt_name, $section );
'icon' => 'el el-list-alt',
'title' => esc_html__( 'Customizer Only', 'your-textdomain-here' ),
'desc' => '<p class="description">' . esc_html__( 'This Section should be visible only in Customizer', 'your-textdomain-here' ) . '</p>',
'customizer_only' => true,
'id' => 'opt-customizer-only',
'title' => esc_html__( 'Customizer Only Option', 'your-textdomain-here' ),
'subtitle' => esc_html__( 'The subtitle is NOT visible in customizer', 'your-textdomain-here' ),
'desc' => esc_html__( 'The field desc is NOT visible in customizer.', 'your-textdomain-here' ),
'customizer_only' => true,
'1' => esc_html__( 'Opt 1', 'your-textdomain-here' ),
'2' => esc_html__( 'Opt 2', 'your-textdomain-here' ),
'3' => esc_html__( 'Opt 3', 'your-textdomain-here' ),
* YOU MUST PREFIX THE FUNCTIONS BELOW AND ACTION FUNCTION CALLS OR OTHER CONFIGS MAY OVERRIDE YOUR CODE.
* --> Action hook examples.
// Function to test the compiler hook and demo CSS output.
// Above 10 is a priority, but 2 is necessary to include the dynamically generated CSS to be sent to the function.
// add_filter('redux/options/' . $opt_name . '/compiler', 'compiler_action', 10, 3);
// Change the arguments after they've been declared, but before the panel is created.
// add_filter('redux/options/' . $opt_name . '/args', 'change_arguments' );
// Change the default value of a field after it's been set, but before it's been used.
// add_filter('redux/options/' . $opt_name . '/defaults', 'change_defaults' );
// Dynamically add a section.
// It can be also used to modify sections/fields.
// add_filter('redux/options/' . $opt_name . '/sections', 'dynamic_section');
if ( ! function_exists( 'compiler_action' ) ) {
* This is a test function that will let you see when the compiler hook occurs.
* It only runs if a field's value has changed and compiler=>true is set.
* @param array $options Options values.
* @param string $css Compiler selector CSS values compiler => array( CSS SELECTORS ).
* @param array $changed_values Any values changed since last save.
function compiler_action( array $options, string $css, array $changed_values ) {
echo '<h1>The compiler hook has run!</h1>';
// phpcs:ignore WordPress.PHP.DevelopmentFunctions
print_r( $changed_values ); // Values that have changed since the last save.
// print_r($options); //Option values.
// print_r($css); // Compiler selector CSS values compiler => array( CSS SELECTORS ).
if ( ! function_exists( 'redux_validate_callback_function' ) ) {
* Custom function for the callback validation referenced above
* @param array $field Field array.
* @param mixed $value New value.
* @param mixed $existing_value Existing value.
function redux_validate_callback_function( array $field, $value, $existing_value ): array {
if ( 1 === (int) $value ) {
$value = $existing_value;
} elseif ( 2 === (int) $value ) {
$value = $existing_value;
$return['value'] = $value;
$field['msg'] = 'your custom error message';
$return['error'] = $field;
if ( true === $warning ) {
$field['msg'] = 'your custom warning message';
$return['warning'] = $field;
if ( ! function_exists( 'dynamic_section' ) ) {
* Custom function for filtering the section array.
* Good for child themes to override or add to the sections.
* Simply include this function in the child themes functions.php file.
* NOTE: the defined constants for URLs and directories will NOT be available at this point in a child theme,
* so you must use get_template_directory_uri() if you want to use any of the built-in icons.
* @param array $sections Section array.
function dynamic_section( array $sections ): array {
'title' => esc_html__( 'Section via hook', 'your-textdomain-here' ),
'desc' => '<p class="description">' . esc_html__( 'This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.', 'your-textdomain-here' ) . '</p>',
'icon' => 'el el-paper-clip',
// Leave this as a blank section, no options just some intro text set above.
if ( ! function_exists( 'change_arguments' ) ) {
* Filter hook for filtering the args.
* Good for child themes to override or add to the args array.
* It can also be used in other functions.
* @param array $args Global arguments array.
function change_arguments( array $args ): array {
$args['dev_mode'] = true;
if ( ! function_exists( 'change_defaults' ) ) {
* Filter hook for filtering the default value of any given field. Very useful in development mode.
* @param array $defaults Default value array.
function change_defaults( array $defaults ): array {
$defaults['str_replace'] = esc_html__( 'Testing filter hook!', 'your-textdomain-here' );
if ( ! function_exists( 'redux_custom_sanitize' ) ) {
* Function to be used if the field sanitizes argument.
* Return value MUST be formatted or cleaned text to display.
* @param string $value Value to evaluate or clean. Required.
function redux_custom_sanitize( string $value ): string {
foreach ( explode( ' ', $value ) as $w ) {
foreach ( str_split( $w ) as $k => $v ) {
if ( ( $k + 1 ) % 2 !== 0 && ctype_alpha( $v ) ) {
$return .= mb_strtoupper( $v );