Warning sprintf(): Too few arguments Not seeing where the issue is in my code [duplicate]

This question already has an answer here:

Why am I getting the error “Warning: sprintf(): Too few arguments in” when I use svg to replace the existing code?
I was give this PHP sprintf escaping % as an answer but I’m not seeing it in my code.
Seems that the part of the code creating the issue in the svg element is this:

<defs>
    <linearGradient id="grad1" x1="0%" y1="0%" x2="0%" y2="100%">
        <stop offset="0%" style="stop-color:rgb(34, 34, 34);stop-opacity:1" />
        <stop offset="100%" style="stop-color:rgb(4, 0, 230);stop-opacity:1" />
    </linearGradient>
</defs>
<text fill="url(#grad1)" x="130" y="97%" text-anchor="middle">WS</text>

If I remove the above code I don’t get the error. Existing code that works fine:

// Modify site title
add_filter('genesis_seo_title', 'sp_seo_title', 10, 3);
function sp_seo_title($title, $inside, $wrap) {
    $inside = sprintf( '<a href="/" title="%s">%s<span class="ws-title">WS</span><span class="plays-title">Plays</span><span class="members-title">members</span></a>', esc_attr( get_bloginfo('name') ), get_bloginfo('name') );
    $title = sprintf('<%s class="site-title">%s</%s>', $wrap, $inside, $wrap);
    return $title;
}
//END

Code I get the error with:

// Modify site title svg
add_filter('genesis_seo_title', 'sp_seo_title', 10, 3);
function sp_seo_title($title, $inside, $wrap) {
    $inside = sprintf( '<a href="/" title="%s">%s<div class="ws-title">
    <svg height="168" width="146.467">
        <defs>
            <linearGradient id="grad1" x1="0%" y1="0%" x2="0%" y2="100%">
                <stop offset="0%" style="stop-color:rgb(34, 34, 34);stop-opacity:1" />
                <stop offset="100%" style="stop-color:rgb(4, 0, 230);stop-opacity:1" />
            </linearGradient>
        </defs>
        <text fill="url(#grad1)" x="130" y="97%" text-anchor="middle">WS</text>
        Sorry, your browser does not support inline SVG.
    </svg>
</div>
<span class="plays-title">Plays</span><span class="members-title">members</span></a>', esc_attr( get_bloginfo('name') ), get_bloginfo('name') );
    $title = sprintf('<%s class="site-title">%s</%s>', $wrap, $inside, $wrap);
    return $title;
}
//END

How can I fix this code to resolve the error?

Read more here: Warning sprintf(): Too few arguments Not seeing where the issue is in my code [duplicate]

Leave a Reply

Your email address will not be published. Required fields are marked *