Can’t seem to get [shortcode]s to work

As Milo indicated:

functions.php is a file within your current
theme
, not the
functions.php file in wp-includes. There’s nothing wrong with your
code as-is as long as it’s in a file that’s actually being loaded at
the correct time.

Addressing your other question from the comments, yes, this code can be wrapped up into a plugin file. Once the plugin has been activated, you’d just need to place your [my_shortcode] shortcode within a post/page content area, and it will be executed.

Leave a Comment