Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:25:51+00:00 2026-06-13T11:25:51+00:00

I’ve seen many posts on various sites which talk about adding to your HTML

  • 0

I’ve seen many posts on various sites which talk about adding “to your HTML Purifier config”, like Sonny’s excellent response to this question: HTMLPurifier iframe Vimeo and Youtube video

However, try as I might, I can’t seem to discover exactly how to set up my HTML Purifier config. I’m actually trying to add a custom filter a la Sonny’s comment, but the closest I can come to discovering how to set up my HTML purifier config in my Drupal 7 environment is from /sites/all/modules/htmlpurifier/config/sample.php:

<?php

/**
 * @file
 * This file is a sample advanced PHP configuration file for the HTML Purifier
 * filter module. In reality, this file would be named N.php, where N is the
 * integer identifying the filter this is configuring. The configure page
 * for HTML Purifier (advanced) will tell you what file to copy this to.
 *
 * See this URI:
 *
 *    http://htmlpurifier.org/live/configdoc/plain.html
 *
 * For full information about permitted directives. The most interesting ones
 * for custom configuration are ones with the 'mixed' type, as they cannot
 * be configured using the webform.

But this hasn’t helped me at all – I don’t see anything on the HTML Purifier (advanced) configure page (on the text filter config page? I don’t see anything there…), and the doc at the URI above didn’t help, either.

Edit: much thanks to @Chris for his answer to my original question. I subsequently found that creating the filtered_html.php file removes the ability for me to configure HTML Purifier for Filtered HTML from the UI! Is this supposed to happen?

All that I see from the UI when looking at HTML Purifier (Advanced) is the checkbox for “Display help text”. (I already added this as a comment below, but I thought I’d modify my question as well in the hopes that more people would see this…)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:25:52+00:00Added an answer on June 13, 2026 at 11:25 am

    First, make sure you have the HTML purifier library installed as show in the INSTALL.txt file. The status report page will show you the version if it’s installed correctly.

    In Drupal 7 the filter system now uses string keys rather than integer. So to create a configuration file for the format “Filtered HTML” under sites/all/modules/htmlpurifier/config/, copy sample.php to filtered_html.php, and update the hook function name like this:

    function htmlpurifier_config_filtered_html($config) {
    

    The rest of the tutorial above worked for me, and now my preFilter and postFilter functions are being called.

    I thought you could do this through the UI, but it looks like the “Filters” custom configuration box is not evaluated as PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.