Support » Networking WordPress » Filtering the_content

  • I’m running a multiuser network on localhost and encountering strange problems – see
    Here’s another one in the hope that it will inspire a ‘eureka’ moment in someone brighter than I.

    The problem only appears on a localhost multiuser site using several themes, including twenty-twelve. It does not appear on my live multiuser site or a localhost single site.

    I have written a plugin that attaches a filter to the_content.
    The filtering function is, in its debugging incarnation,

    function filter_content ($content) {
        echo 'XX';
        return 'Filter!';

    If the post is “My Post”, the result on the home page is:
    My Post”

    –unless I change the priority of the filter to 11 or higher, whence the output is:
    “My Post

    In the first case, the_content() is returning the post and ignoring the output of the filter. In the second case it appends the output of the filter to the post.

    I understand neither behavior.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Where is this filter located? Is the plugin active on all sites or in MU-plugins?

    The filter is in the plugin. The plugin hooks it into the_content using add_filter() (is that what you mean?)

    The MU network has 2 users. Both act the same when they have the plugin enabled. It still fails in one site if the other has the plugin deactivated.

    I don’t know the difference between ‘active on all sites’ and ‘active in MU-plugins’
    Under wp-admin/network, the plugin is not network activated and it fails identically if I ‘network activate’ it.

    The local site uses WAMP 2.2, PHP 5.2.9-2, and SQL 5.5.16, which has all worked with no problems except for a reluctance to change PHP versions.

    And Apache 2.2.21

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Close enough 🙂

    Can you share the code on this one?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Filtering the_content’ is closed to new replies.