Forums

[closed] How to register a filter? (2 posts)

  1. PaulMMM
    Member
    Posted 2 years ago #

    i'm writing a plugin and trying to register a filter, but error happens.
    <?php
    /*
    Plugin Name: my
    Plugin URI: http://my.org/
    Description: my
    Author: my
    Version: 1.0
    */

    function myfunction1($comment = '') {
    }
    add_filter('comment_text', 'myfunction1');

    function myfunction2($s) {
    }
    add_filter('mod_rewrite_rules', 'myfunction2');
    ?>

    Then I activate the plugin, the first filter registers good, but the second doesn't. It shows this error when I register it:

    Fatal error: Cannot redeclare myfunction1() (previously declared in Z:\home\site\www\wp-content\plugins\hello.php:11) in Z:\home\site\www\wp-content\plugins\hello.php on line 11

    Why is it so and how can I register a filter? Thanks.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Duplicate post...please continue discussion here:
    http://wordpress.org/support/topic/328174

Topic Closed

This topic has been closed to new replies.

About this Topic