Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Created November 29, 2021 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickcernis/35726127cb352233245919dfd46c2914 to your computer and use it in GitHub Desktop.
Save nickcernis/35726127cb352233245919dfd46c2914 to your computer and use it in GitHub Desktop.
Prevent footer text escaping in Genesis
<?php
// Omit the opening <?php above when adding this to your active theme's functions.php.
add_filter( 'genesis_footer_output', 'custom_genesis_do_footer_unmodified' );
/**
* Outputs Genesis footer text without calling `wp_kses_post()`
* to strip attributes for security purposes.
*/
function custom_genesis_do_footer_unmodified() {
$footer_text = genesis_get_option( 'footer_text' );
return '<p>' . genesis_strip_p_tags( $footer_text ) . '</p>';
}
add_filter( 'genesis_customizer_theme_settings_config', 'custom_genesis_enable_footer_settings' );
/**
* Ensures footer text is still available to edit in Genesis site settings.
*
* @param array $config The settings.
* @return array Updated settings with Genesis footer always enabled.
*/
function custom_genesis_enable_footer_settings( $config ) {
$config['genesis']['sections']['genesis_footer']['active_callback'] = '__return_true';
return $config;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment