For some reason, this elementary shotcode does not work! I did everything as documentation, but even this one simply doesn’t work .... What could be the reason? File functions.php (themes that are installed):

//[foobar] function foobar_func( $atts ){ return "foo and bar"; } add_shortcode( 'foobar', 'foobar_func' ); 
  • one
    and where is the registration of taxonomy? - KAGG Design
  • one
    You provided a code that adds only a custom type of post. add a code that registers the taxonomy. but generally, judging by 'taxonomies' => array( 'Movie' ) names are so different - alenkins
  • Yes, thanks, I already understood, therefore I redid the question! - Alexander
  • one
    how do you use it, this shortcode? - KAGG Design
  • one
    show how you are using shortcode - KAGG Design

1 answer 1

Your shortcode returns, not output. An example of an elementary shortcode that displays "Hello World!":

In functions.php:

  function my_shortcode(){ echo 'Hello World!'; } add_shortcode( 'helloworld', 'my_shortcode' ); 

After that, in a regular editor, for example, in the admin [helloworld] used in the form of [helloworld] , and if in a php page or code, then echo do_shortcode('[helloworld]');