I have a custom field in the theme Customizer that allow to define own copyright information. I created a shortcode displaying the current year. How to make the shortcode work when someone has pasted it into textarea?

I use Kirki framework to create theme options.

Kirki::add_field( 'my_customizer', array(
  'type'     => 'editor',
  'settings' => 'copyright',
  'label'    => __( 'Content', 'mytheme' ),
  'section'  => 'section_footer',
  'default'  => __( 'Copyright ⓒ All rights reserved.', 'mytheme' ),
  'description' => __( 'You can use [current-year] shortcode if you want.', 'mytheme' ),
) );

To display above option I add this to footer.php:

echo Kirki::get_option( 'my_customizer', 'copyright' );

What I see on the site:

Copyright ⓒ [current-year] All rights reserved.
All rights reserved. ⓒ [current-year] by XYZ 
All rights reserved. ⓒ 2016 - [current-year]

What I need to achieve:

Copyright ⓒ 2019 All rights reserved.
All rights reserved. ⓒ 2019 by XYZ 
All rights reserved. ⓒ 2016 - 2019

Any solution / idea? Thanks!

1 Answer 1


If you have a shortcode string saved, try echoing it with do_shortcode function, which turns shortcodes into content.

$saved_shortcode = get_option( 'my_customizer', 'copyright' );
if ( $saved_shortcode && is_string( $saved_shortcode ) ) {
echo do_shortcode( $saved_shortcode );

More about the function on the developer handbook, https://developer.wordpress.org/reference/functions/do_shortcode/


Another option is just echo the year directly on the footer template without first getting the shortcode string from the database and then rendering it.

  • That works! Thank you :)
    – Avigo
    Commented Jun 3, 2019 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.