Forums

Help With Hooks (1 post)

  1. Seans0n
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags