• Hello! I noticed that the page code now has single or double quotation marks in the tags. I changed the theme to the standard one, disabled plugins, everything remains as it was. Example meta name=’robots’ and meta name=”robots” and so it is on all pages, that is, double quotes, and somewhere single quotes. I want to lead to double quotes. I am attaching a screenshot https://disk.yandex.ru/i/eYmRY-TBYI0whg Help please!

Viewing 1 replies (of 1 total)
  • Moderator threadi

    (@threadi)

    First of all, I’m not sure why you specifically want to use double quotes here. According to the HTML standard, single quotes are also allowed. But from a perfectionist’s perspective, I can at least understand the question. 🙂

    For the robots tag, the output in this format comes from the WordPress code itself. It’s defined here: https://github.com/WordPress/WordPress/blob/master/wp-includes/robots-template.php#L49

    Of course, you can’t – and shouldn’t – modify this file. One solution, however, could be the sledgehammer approach, which I’m reluctant to use but consider a last resort for something like this:

    function custom_replace_quotes( $buffer ) {
    // Here you can change the HTML content
    return str_replace( "'robots'", '"robots"', $buffer );
    }

    add_action( 'template_redirect', function() {
    ob_start();
    ob_start( 'custom_replace_quotes' );
    });

    This involves modifying the robots tag. The other tags would then need to be adjusted in a similar way since they are dynamically generated by the core.

    If you’d like to see a change in the core regarding this, feel free to submit a ticket to the developers here: https://core.trac.wordpress.org/newticket

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.