Forums

disable filter but still problem with << (2 posts)

  1. jwxie
    Member
    Posted 3 years ago #

    I went to wp-included/kses.php and edit the code to disable this annoying filter (i am sorry)
    it is annoying because i need to post my code onto the blog
    if i don't, the system will automically filter out my < and > tag

    let say #include <iostream>
    once it is filter, it will only with #include

    so i went ahead and made these two lines commented
    //add_action('init', 'kses_init');
    //add_action('set_current_user', 'kses_init');

    it worked but my code
    cout <<"hello-world!\n";
    became
    cout < <"hello-world!\n";

    so i searched again and instead i made this change in the kses.php
    [code] // Post filtering
    // add_filter('content_save_pre', 'wp_filter_post_kses');
    add_filter('excerpt_save_pre', 'wp_filter_post_kses');
    // add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
    }

    function disable_kses_content() {
    remove_filter('content_save_pre', 'wp_filter_post_kses');
    }
    add_action('init','disable_kses_content',20);[/code]

    but the result is the same
    i can disable the filter, but the tag is no longer <<, it became < <

    anyone can help me out to solve this problem?

  2. Chris_K
    Member
    Posted 3 years ago #

    Just out of curiosity, and to avoid typing a long lecture about encoding brackets before rendering them on web pages, have you considered using any of the many (dozens?) of plugins aimed at posting code on WP blogs? Might be a lot easier than hacking core code. The hacking method hurts a bit every time you upgrade and lose all those changes ;-)

    For instance, I've been using iG:Syntax Hiliter for years and have been quite happy with it. Haven't ever had to modify core WP code either.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags