I'm working my way through making my first plugin, a link directory, and as part of it I want the plugin to check for tags (ie [wplinkdir page : linkdir] or [wplinkdir page : categories]) when a new page is created, and to replace it with content generated by the plugin.
My code looks like this:
add_action('publish_page', 'wplinkdir_replace_pages');
function wplinkdir_replace_pages($entry){
$replacement='I am the replacement text.';
return str_ireplace('[wplinkdir page : linkdir]',$replacement,$entry);
}
But for some reason it wont work. Am I missing something out or doing something wrong?