WordPress.org

Ready to get started?Download WordPress

Forums

How to Sanitize the Google Analytics Tracking Code on Options Page (1 post)

  1. maxamad
    Member
    Posted 2 years ago #

    Can any one please help me how to sanitize google analytics code in WordPress Theme Options Page.

    I am concerned about XSS if I simply use the code
    $input['id'] = stripslashes( $input['id'] );

    But at the same time, if I use the following code, it will strip out all the Tags.
    $input['id'] = stripslashes(wp_filter_post_kses( $input['id'] ));

    I read Otto comments about wp_filter_post_kses - I think this deals with regular HTML, making sure that not bad Tags slips through, at same time it filters out Java Code, and so Google code will be striped out.

    So please can some one tell me what is best practice on this issue. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic