Trouble adding filter to the_content()
-
Hello There,
I am working on a plugin that will automatically add anchor tags to the content with the user having to do anything. Basically I want to replace all header tags (h1, h2, h3, etc.) with
<a name='foo1'></a><h3>foo2</h3>.
But for right now I would be happy just replacing ‘a’ with a ‘b’.
function kroc_add_anchors_to_content( ) { $kroc_result = the_content(); $kroc_patterns[] = "/a/"; $kroc_replacements[] = "/b/"; $kroc_result = preg_replace($kroc_patterns, $kroc_replacements, $kroc_result); return $kroc_result; }//function add_filter( 'the_content', 'kroc_add_anchors_to_content', 9 );
When I run this code I get errors:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 10071 bytes) in /home/therefor/public_html/kroc/wp-includes/media.php on line 1256
Any ideas?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Trouble adding filter to the_content()’ is closed to new replies.