I provided an answer here that included line numbers, such as:

 1 <?php
 3 apply_filters( 'the_content', function( $c ) {
 4     // blah
 5 } );

I came in today to find a message about an edit in my inbox, when I viewed it appears that moderator had edited my answer to remove the line numbers. I don't mind this, but I'm curious why it was done. I like the idea of being able to point to specific line numbers when explaining an answer, for example, but I'm sure there's a good reason for this edit that I may not be thinking of (do line numbers make it more difficult for copy/paste, for example?).

  • It does indeed make copy pasting annoying, especially if you're copying it into a PHP file, not to mention syntax highlighting
    – Tom J Nowell Mod
    Feb 6, 2019 at 16:37

1 Answer 1


Usually when code is posted as answers it's as direct and to the point as possible. Like many code-related Stack Exchange sites users come into the answers and copy / paste the solution. To copy / paste the solution the end user would need to then remove the line number to add it to their codebase. The same could be said about the PHP tags. When explaining your code it may be best use keywords instead:

The $c content variable is passed into the the_content filter.

You may also want to consider adding PHP comments to the code itself to explain what variables are or what functions do:

 * Modify the post content
 * @param String $c     - The passed post content
 * @return String $c
apply_filters( 'the_content', function( $c ) {
    // Modify the post content here.
} );
  • 1
    I thought that might be the case, but good to see it clarified. Thanks!
    – phatskat
    Feb 4, 2019 at 3:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .