Replacing a Post based on regex
Ok what I’m trying to do is kind of weired and I’m not the best with PHP/WP hooks.
I created a plug in for a meme that I manage, and the blog is http://amiest.musicwednesday.com. That way you can look and see what I did with the current plugin if you would like.
I’m not sure that I’m doing this correcty, but what I’m trying to get done is in this order:
1) Get post
2) place information before and after post.
$post = 'some data here' . $post . 'some more data here';
3) push the $post with the new information back into the database.
I would like this to happen when it is published. I have tried save_post and publish_post with no luck at all.
I also know that I have to do a preg_match so that it will know what post to apply the plugin to. The regex needs to be dynamic numbers like
([0-9]*). I was looking at something like
$dyno = '/(\[([0-9]*)\])/';this way it would match
. I am not even sure that this is correct.
I hope that I have provided enough information for some help to get me pointed in the right direction. Thank you in advance.
- The topic ‘Replacing a Post based on regex’ is closed to new replies.