Replace word in Post
I tried to realize a plugin that would allow me to replace some words by others in the post. I created the DB contained the words to replace and the word to put instead, i created the function and all is working fine, BUT, I don’t find how to use it on BBPRESS.
My function is something like
, and the function use the DB to see what is be put instead of the $WordToReplace. As I can see, the post are printed out from the post.php of the template we do use.
I got this:
$tset="A trial phrase.";
<?php echo replace_words( $test,$WordToBeReplaced); post_text()?></div>
<?php printf( __('Posted %s ago'), bb_get_post_time() ); ?>
<?php post_ip_link(); ?> <?php post_edit_link(); ?>
<?php post_delete_link(); ?></div>
It print me exactly as I want the “A trial phrase” replace trial by “new” (from the DB).
The problem is that when I want to apply this to the text of the post, post_text(), it won’t work at all. I see that this post_text() is actually applying filters and others to the text, which my cause my function to fail (no error, it just don’t replace the words).
Could someone tell me where should I apply my own filter replace_words() for it to be taken into account?
Thank you very much.
You must be logged in to reply to this topic.