Error creating a Shortcode
-
Hi there,
I’m trying to create shortcodes and I started with the examples that shows the WordPress Codex
function foobar_func( $atts ){
return “foo and bar”;
}
add_shortcode( ‘foobar’, ‘foobar_func’ );I put that code in function.php file and when I run WordPress it returns that error:
Fatal error: Call to undefined function add_shortcode() in XXXX on line YYY
EDIT: I solved the problem, the error was that i wrote the function in the wrong functions.php. Now I put the function in function.php of my theme and works good.
- The topic ‘Error creating a Shortcode’ is closed to new replies.