Title: PHP Notice: Undefined variable
Last modified: January 17, 2018

---

# PHP Notice: Undefined variable

 *  Resolved [ma3ry](https://wordpress.org/support/users/ma3ry/)
 * (@ma3ry)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/php-notice-undefined-variable-9/)
 * Can you please help me fix a PHP Notice in debug.log file as follows:
 * PHP Notice: Undefined variable: comment_id in /public_html/wp-content/plugins/
   Gallery/Gallery.php on line 39
 * Thank you.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-notice-undefined-variable-9%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [richteam](https://wordpress.org/support/users/richteam/)
 * (@richteam)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/php-notice-undefined-variable-9/#post-9881501)
 * Dear [@ma3ry](https://wordpress.org/support/users/ma3ry/).
 * Thank You for posting your question. Now I will say you how to solve that problem.
   Please open that file where it says you have that problem, find there comment_id
   and add this 2 rows before it.
 * $bare_url = ”; $comment_id = ”;
 * It will help You to solve your problem.
 * Thank You.
 *  Thread Starter [ma3ry](https://wordpress.org/support/users/ma3ry/)
 * (@ma3ry)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/php-notice-undefined-variable-9/#post-9882283)
 * Thank you so much. Can you tell me please exactly where I put this line of code.
   I have tried it in several places but I still get the error.
 * 35. add_action(“admin_menu”, ‘Rich_Web_Gallery_Admin_Menu’ );
    36. function Rich_Web_Gallery_Admin_Menu()
   37. { 38. $complete_url = wp_nonce_url( $bare_url, ‘edit-menu_’.$comment_id, ‘
   Rich_Web_Gallery_Nonce’ ); 39. add_menu_page(‘Rich-Web Gallery Admin’ . $complete_url,’
   Image Gallery’,’manage_options’,’Rich-Web Gallery Admin’ . $complete_url,’Manage_Rich_Web_Gallery_Admin’,
   plugins_url(‘/Images/admin.png’,__FILE__)); 40. add_submenu_page( ‘Rich-Web Gallery
   Admin’ . $complete_url, ‘Rich-Web Gallery Admin’, ‘Gallery Manager’, ‘manage_options’,‘
   Rich-Web Gallery Admin’ . $complete_url, ‘Manage_Rich_Web_Gallery_Admin’);
 *  Thread Starter [ma3ry](https://wordpress.org/support/users/ma3ry/)
 * (@ma3ry)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/php-notice-undefined-variable-9/#post-9882500)
 * Tech support has once again come to my rescue and has fixed the issue in a very
   timely manner. Thank you!
    -  This reply was modified 8 years, 4 months ago by [ma3ry](https://wordpress.org/support/users/ma3ry/).

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

The topic ‘PHP Notice: Undefined variable’ is closed to new replies.

 * ![](https://ps.w.org/gallery-image-gallery-photo/assets/icon-128x128.png?rev=
   1528694)
 * [Image Gallery - Grid Gallery](https://wordpress.org/plugins/gallery-image-gallery-photo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gallery-image-gallery-photo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gallery-image-gallery-photo/)
 * [Active Topics](https://wordpress.org/support/plugin/gallery-image-gallery-photo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gallery-image-gallery-photo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gallery-image-gallery-photo/reviews/)

## Tags

 * [PHP Notice](https://wordpress.org/support/topic-tag/php-notice/)
 * [undefined variable](https://wordpress.org/support/topic-tag/undefined-variable/)

 * 3 replies
 * 2 participants
 * Last reply from: [ma3ry](https://wordpress.org/support/users/ma3ry/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/php-notice-undefined-variable-9/#post-9882500)
 * Status: resolved