My private shortcode sets the content parameter to an empty string

I am registering a shortcode with the following:

class Resource extends Shortcode
{
    public function action($atts, $content = "broken")
    {
        $markup = "<span id='examp'> $content </span>";

        return $markup;
    }
}

$resource = new Resource;
$resource->register();

in the $resource->action(...)$ content is set empty string regardless of the short code.

Full code samples can be found for Shortcode and Resource.

I literally have no other problems with this. The $ attr parameter is exactly the same as it should be, and the only thing that is displayed is the value of $ content without additional markup. If this is not enough, I will share the repository - just let me know if this helps.

Input Example:

asdf[resource_download]abc[/resource_download]asdf

Expected Conclusion:

asdf<span id='examp'>abc</span>asdf

Actual output:

asdfabcasdf    
+4
source share
1 answer

@uɐɥʇɐᴎ , ,

stealshortcode ( ). [(.*?)], null , .

stealshortcode , shortocde.

+2

Source: https://habr.com/ru/post/1529367/


All Articles