cashbagg Posted November 6, 2006 Share Posted November 6, 2006 Hi, I needed a plugin for Wordpress that will automatically add 'http://hornyoyster.com/test/out.php?l=' before any URL I create. This is to track outclicks. It's a pain to enter that manually everytime.Anyway, asked around and was given this answer:[i][b]Well, if you want to roll your own plugin, you need to understand filters.A filter receives some text, modifies it, and returns it. So something like this would do the job:function adjust_links($content){// use regular expressions to modify $content herereturn $content;}add_filter('the_content','adjust_links');Your function would then be called every time a post is displayed, and it would contain the content of the post. So you could add code to find and modify your links accordingly. [/b][/i]I interpreted this as:[i][b]function adjust_links($content){// http://hornyoyster.com/test/out.php?l=return $content;}add_filter('the_content','adjust_links');?>[/b][/i]I uploaded plugin to wordpress and activated it. Did a test post with a link, and my tag did not show. Can anyone steer me right? Link to comment https://forums.phpfreaks.com/topic/26354-need-help-writing-a-wordpress-plugin/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.