Well here I am again with a problem that I just can't seem to figure out. I have searched and searched, found answers but I just can't seem to get this to work.
I have a theme called WP-Forge and it uses the theme customizer extensively. One of the options available to users is to add or modify the copyright text in the footer. This could be something as simple as them changing the year or company name but more often than not people like to add a link to a site. I keep getting emails about html not outputting the way it should. So I would like to figure this out.
In the theme customizer of WP-Forge I have the following setting and control:
$wp_customize->add_setting('wpforge_footer_text',array(/* footer text */ 'default' => '', 'type' => 'theme_mod', 'transport' => 'postMessage', 'sanitize_callback' => 'wpforge_sanitize_text', 'priority' => 20, )); $wp_customize->add_control('wpforge_footer_text',array( 'label' => __('Footer Text','wp-forge'), 'section' => 'footer_content', 'type' => 'textarea', ));
as you can see the sanitize callback is wpforge_sanitize_text
. Here is the sanitize function:
function wpforge_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); }
It works fine if you just enter in text. However, if I add the following:
Copyright © 2015 - <a href="http://somelinkhere.com">SomeLinkHere</a>
I get this in the preview window:
Copyright © 2015 - SomeLinkHere
Everything looks good so I then hit save and publish and look at the home page I see this:
Copyright © 2015 - <a href="http://somelinkhere.com">SomeLinkHere</a>
So what exactly am I missing? Can someone help me get this working the way I want it? Any help is greatly appreciated and I thank you in advance.
<?php echo esc_attr(get_theme_mod( 'wpforge_footer_text')); ?>