Title: Code Snippet to Comment Out PHP Code Line(s)
Last modified: June 15, 2023

---

# Code Snippet to Comment Out PHP Code Line(s)

 *  Resolved [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/code-snippet-to-comment-out-php-code-lines/)
 * Good Day,
 * Here’s a challenge 🙂
 * Does anyone know what code snippet we can use to comment out a particular plugin’s
   php file code line(s) using either **//** for a single line of code or **/\* 
   code here \*/** for several lines of code?
 * The code snippet would have to know the plugin’s php file name and line of code(
   s) affected.
 * Thank you!

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

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/code-snippet-to-comment-out-php-code-lines/#post-16823747)
 * I imagine this would be possible, but it’d require reading and writing to files,
   which can be fraught with difficulty.
 * Is there a reason why you’re preferring to comment out code instead of using 
   a filter hook or similar to toggle functionality?
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/code-snippet-to-comment-out-php-code-lines/#post-16824693)
 * Hi [@bungeshea](https://wordpress.org/support/users/bungeshea/),
 * If the code snippet is too difficult to develop, please ignore our request.
 * The reason for the request is because some of the plugins we use are customized
   to suit our needs. Customization sometimes requires commenting out plugin file
   code lines. Unfortunately, when the affected plugin is updated, the commented
   out code lines are reinstated. Makes sense?
 * Thank you!
 *  Thread Starter [generosus](https://wordpress.org/support/users/generosus/)
 * (@generosus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/code-snippet-to-comment-out-php-code-lines/#post-16860100)
 * **Update:**
 * We’ve decided not to pursue this.
 * Thank you.

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

The topic ‘Code Snippet to Comment Out PHP Code Line(s)’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [generosus](https://wordpress.org/support/users/generosus/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/code-snippet-to-comment-out-php-code-lines/#post-16860100)
 * Status: resolved