I’m trying to make a wordpress plugin but not working and do not know what can be. The plugin should take posts by get_the_content
but with formatting.
<?php
register_activation_hook('__FILE__', 'texto');
add_filter ('the_content', 'texto');
function texto ($text){
$text = get_the_content( '' );
$text = apply_filters( 'the_content', $text );
$text = strip_tags( $text, '<p></br>' );
return $text;
};
?>
This is not working. With $text = apply_filters ('the_content', $ text);
the blog does not load, if I take $text = apply_filters ('the_content', $ text);
posts have no formatting.
You must remove the single quotes around
__FILE__
to fix the problem. The filename is in your case not resolved correctly.See this link https://codex.wordpress.org/Function_Reference/register_activation_hook