Support » Theme: Twenty Twenty-One » Shortcode does not work on home page

  • Hi,

    Starting from a fresh install of WordPress using the official Docker image.

    I am adding a shortcode with a plugin. To test I have added this code to my main plugin file so I am 100% sure it is running:

    add_shortcode( 'name', 'demo_shortcode_callback_function' );
    function demo_shortcode_callback_function($atts, $content, $shortcode) {
    	return "Welcome to WordPress";

    If I use the shortcode [name] in the “Hello World” blog post then:

    1. When I view the site from the root the shortcode does not work
    2. The shortcut works if I visit ?p=1 and show just the “hello world” page.

    It happens if I use the visual editor, or if I use the code editor.

    It happens when using either of these formats in code:

    <!-- wp:paragraph -->
    <p>Welcome [name]!</p>
    <!-- /wp:paragraph -->
    Or this one:

    This seems to be an issue with the theme.

    Is this a bug? Or is it deliberate that the shortcode doesn’t seem to work on the homepage?

  • The topic ‘Shortcode does not work on home page’ is closed to new replies.