Title: [Plugin: External Gallery2 Image Block Plugin] Call to undefined function sanitize()
Last modified: August 19, 2016

---

# [Plugin: External Gallery2 Image Block Plugin] Call to undefined function sanitize()

 *  [desean](https://wordpress.org/support/users/desean/)
 * (@desean)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/)
 * I got the following error with version 0.1.4 on the current WP version
 *     ```
       G2 ImageBlock
   
       Fatal error: Call to undefined function sanitize() in /home/ds/dragonscouts.com/home/wp-content/plugins/Gallery2_ImageBlock.php on line 109
       ```
   
 * FYI, I had edited my gallery path. Is there anything that I did not do or is 
   some code missing?
 * [http://wordpress.org/extend/plugins/gallery2-image-block-widget/](http://wordpress.org/extend/plugins/gallery2-image-block-widget/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [desean](https://wordpress.org/support/users/desean/)
 * (@desean)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872224)
 * isn’t there someone who has the same problem as me?
 *  [Lentil](https://wordpress.org/support/users/lentil/)
 * (@lentil)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872226)
 * Hi Desean. I just got your comment at the blog. I’ll try to look at this tonight
   when I get home from work…
 * Could you post your current WP version (you said latest, but that could mean 
   several things) and what plugins you have installed?
 * At first glance, it appears that “sanitize” is a function in:
    [/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php](http://xref.redalt.com/wptrunk/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php.htm)
 * This feature is installed as part of the base WP package (even though it is in
   the plugin folder). Do you have the file listed above? It looks like WP may not
   be finding that code any more.
 * You mentioned editing your path, this could be an issue here. I’m not an expert
   on how WP resolves function paths in concert with php.
 *  [Lentil](https://wordpress.org/support/users/lentil/)
 * (@lentil)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872261)
 * I took another look and didn’t see anything obvious that would cause this… other
   than a path problem.
 * Any additional info?
 *  [Chris](https://wordpress.org/support/users/chris/)
 * (@chris)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872270)
 * I’m having the same issue. All I did was download and activate the plugin.
 * Error: `Fatal error: Call to undefined function sanitize() in /home/eeee/public_html/
   wordpress/wp-content/plugins/gallery2-image-block-widget/Gallery2_ImageBlock.
   php on line 109`
 *  Thread Starter [desean](https://wordpress.org/support/users/desean/)
 * (@desean)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872278)
 * sorry for my late reply. was busy so didn’t check for quite a while.
 * i was using version 2.6.2 then. now using 2.6.3 and the problem still exist
 * when i mentioned editing my path, i meant the path mentioned in your installation
   note: “Configure the `Gallery2 URL` option to match your Gallery install. Do 
   not include `main.php` or the trailing slash.”
 * My gallery URL is [http://www.dragonscouts.com/gallery](http://www.dragonscouts.com/gallery)
 * just so you know, the error occurs in the dashboard under Design > Widgets section(
   see screenshot: [http://bayimg.com/malfhaabN](http://bayimg.com/malfhaabN) )
 * I had thought the function “sanitize” belongs to Gallery instead of wordpress.
   I did a search for “function sanitize” in all my wordpress (exclude plugins) 
   and gallery2 files and the result is as follows:
 *     ```
       gallery2\install\InstallStep.class
       function sanitize($string)
       ```
   
 *     ```
       gallery2\modules\core\classes\GalleryUtilities.class
       function sanitizeInputValues(&$value, $adaptForMagicQuotes=true)
       ```
   
 *     ```
       gallery2\modules\search\classes\SearchUtilities.class
       function sanitizeSearchCriteria($string)
       ```
   
 *     ```
       gallery2\upgrade\UpgradeStep.class
       function sanitize($string)
       ```
   
 *     ```
       wordpress\wp-includes\bookmark.php
       function sanitize_bookmark($bookmark, $context = 'display')
       function sanitize_bookmark_field($field, $value, $bookmark_id, $context)
       ```
   
 *     ```
       wordpress\wp-includes\category.php
       function sanitize_category($category, $context = 'display')
       function sanitize_category_field($field, $value, $cat_id, $context)
       ```
   
 *     ```
       wordpress\wp-includes\comment.php
       function sanitize_comment_cookies()
       ```
   
 *     ```
       wordpress\wp-includes\formatting.php
       function sanitize_file_name( $name ) { // Like sanitize_title, but with periods
       function sanitize_user( $username, $strict = false ) {
       function sanitize_title($title, $fallback_title = '') {
       function sanitize_title_with_dashes($title) {
       function sanitize_sql_orderby( $orderby ){
       function sanitize_email($email) {
       function sanitize_url( $url, $protocols = null ) {
       function sanitize_option($option, $value) { // Remember to call stripslashes!
       ```
   
 *     ```
       wordpress\wp-includes\post.php
       function sanitize_post($post, $context = 'display') {
       function sanitize_post_field($field, $value, $post_id, $context) {
       ```
   
 *     ```
       wordpress\wp-includes\taxonomy.php
       function sanitize_term($term, $taxonomy, $context = 'display') {
       function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
       ```
   
 * it seems that wordpress do not have the sanitize() function. gallery2 have but
   they are in “install\InstallStep.class” & “upgrade\UpgradeStep.class” files. 
   I don’t think gallery2 use these 2 files except during installtion.
 * by the way, i have the following activated plugins (fyi, i have deactivated all
   plugins except this and still got the same error):
    AdSense Manager Akismet All
   in One SEO Pack AskApache Google 404 AskApache Password Protect cforms External
   Gallery2 Image Block Plugin Google Analyticator Google XML Sitemaps Lightbox 
   2 Plugin Post Tabs Subscribe To Comments Wordpress Automatic Upgrade WP-EMail
   WP-EMail Widget WP-FLV WP-PageNavi WP-Print WP Security Scan Yet Another Related
   Posts Plugin
 *  Thread Starter [desean](https://wordpress.org/support/users/desean/)
 * (@desean)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872279)
 * btw to fix this issue currently, i have replaced all sanitize() functions with
   sanitize_title_with_dashes() in Gallery2_ImageBlock.php
 * i don’t know if sanitize_title_with_dashes() is the correct function to use but
   at least your plugin is working for me right now.
 * please let me know what you discover with my above inputs.
 * anyway thanks for this plugin
 *  [nbhq](https://wordpress.org/support/users/nbhq/)
 * (@nbhq)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872317)
 * bump?
 *  [still giving](https://wordpress.org/support/users/nonegiven/)
 * (@nonegiven)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872351)
 * bump … fails and takes down wdiget page.
 * G2 ImageBlock
 * Fatal error: Call to undefined function sanitize() in /usr/home/example/public_html/
   wp-content/plugins/gallery2-image-block-widget/Gallery2_ImageBlock.php on line
   217
 *  [Lentil](https://wordpress.org/support/users/lentil/)
 * (@lentil)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872369)
 * I guess the “watch favorites” feature doesn’t actually work so well. Apologies
   for the perceived abandonment of this thread.
 * The root cause of this issue turns out to be that the “sanitize” function is 
   present on some installations (like mine) only as part of another plugin. OOPS!
 * I’ve created a local “sanitize_key_names” function to resolve this issue.
 * Version 0.1.5 is now winging its way into the repository with this fix.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘[Plugin: External Gallery2 Image Block Plugin] Call to undefined function
sanitize()’ is closed to new replies.

## Tags

 * [gallery](https://wordpress.org/support/topic-tag/gallery/)
 * [gallery2](https://wordpress.org/support/topic-tag/gallery2/)
 * [image block](https://wordpress.org/support/topic-tag/image-block/)
 * [sanitize](https://wordpress.org/support/topic-tag/sanitize/)

 * 9 replies
 * 5 participants
 * Last reply from: [Lentil](https://wordpress.org/support/users/lentil/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-external-gallery2-image-block-plugin-call-to-undefined-function-sanitize/#post-872369)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
