Title: JavaScript error with post types that don&#8217;t support titles
Last modified: May 2, 2017

---

# JavaScript error with post types that don’t support titles

 *  Resolved [Alexandre Simard](https://wordpress.org/support/users/brocheafoin/)
 * (@brocheafoin)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-with-post-types-that-dont-support-titles/)
 * Hey there! (Salut Québec!)
 * Great plugin, obviously. I’m having a small issue with it though. Your JavaScript
   is enqueued on all post edit screens. It also starts straight away by grabbing
   the value of the post title’s form input and performing string operations on 
   it. Unfortunately, this causes JavaScript errors if the title input is not present,
   which _can_ happen, as titles are optional for posts.
 * Here’s my suggested fix:
 *     ```
         global $post;
         if ( 'post.php' != $hook || 'product' != get_post_type( $post ) ) {
       ```
   
 * Use it to replace line 358 in wc-product-customer-list.php. Cheers!
    -  This topic was modified 9 years, 1 month ago by [Alexandre Simard](https://wordpress.org/support/users/brocheafoin/).

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

 *  Plugin Author [Kokomo](https://wordpress.org/support/users/kokomoweb/)
 * (@kokomoweb)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-with-post-types-that-dont-support-titles/#post-9093765)
 * Merci Alex, étrangement j’étais sur d’avoir déja mis cette vérification. je ferai
   la correction dans mon prochain update (major update, pour WC 3). Tant qu’à refaire
   une grosse partie du plugin, est-ce que tu suggère une façon plus efficace pour
   que j’aille chercher le titre du produit pour générer le titre / filename du 
   PDF?
 *  Thread Starter [Alexandre Simard](https://wordpress.org/support/users/brocheafoin/)
 * (@brocheafoin)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-with-post-types-that-dont-support-titles/#post-9094805)
 * L’ajouter dans ton `wp_localize_script`? Ça te permettrait aussi de le _sanitizer_
   en PHP avec les fonctions de WP.
 *  Plugin Author [Kokomo](https://wordpress.org/support/users/kokomoweb/)
 * (@kokomoweb)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-with-post-types-that-dont-support-titles/#post-9097127)
 * Tellement! Merci pour le hint, je vais faire ça. Je te fais signe quand la nouvelle
   version est en ligne!
 *  Plugin Author [Kokomo](https://wordpress.org/support/users/kokomoweb/)
 * (@kokomoweb)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-with-post-types-that-dont-support-titles/#post-9101755)
 * Nouvelle version en ligne, avec wp_localize_script, compat WC 3.0+ pis des nains
   qui font des backflip. Enjoy!

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

The topic ‘JavaScript error with post types that don’t support titles’ is closed
to new replies.

 * ![](https://ps.w.org/wc-product-customer-list/assets/icon-256x256.gif?rev=3531446)
 * [Product Customer List for WooCommerce](https://wordpress.org/plugins/wc-product-customer-list/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wc-product-customer-list/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wc-product-customer-list/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-product-customer-list/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-product-customer-list/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-product-customer-list/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 4 replies
 * 2 participants
 * Last reply from: [Kokomo](https://wordpress.org/support/users/kokomoweb/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-with-post-types-that-dont-support-titles/#post-9101755)
 * Status: resolved