Support » Fixing WordPress » Multiple line Commenting out not possible

  • I came across similar posts that were 2-3 years old about this same topic with no resolution, I was wondering if there is any fix to this issue. In the html editor I can comment out a single line but when I try to do it on a block of code (more than one line) wp converts the angle brackets into the html numbers, resulting in the <!– … –> to show on the page, as well as the code that was supposed to be hiding.

    Only thing i could do was to cut/paste that code and save it for future use just this one time but this is not a good fix. The company hides and shows these banners when promotions start and end.

    The only plugins installed are the Advanced iframe and Embed iframe, and wpautop is already disabled.

    Any clue what could be causing this?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Why not just access the files via FTP and comment them out there?

    are u asking me to go into the database and find the appropriate table just to place <!– … –> around the code?? For one thing I dont have access to the tables, even if I did this is hardly a solution.

    anyone else come across this issue? any real solutions or ideas for this?

    I believe what jherrington has suggested is the best course of action. Editing code directly from the dashboard is neither smart nor efficient.

    Hi Evan, jherrington’s comment sounds like finding the html pages, making the needed edits, followed by uploading/replacing. Let me know if I misunderstood that. If that is the case then that just doesnt make sense since there is no html page. Several pages are recreated from templates, I am not trying to teach how wordpress works but thats basically why his suggestion does not even make sense, no offense jherrington. unless again i misunderstood it.

    I am not sure if the question here is the method of editing text, I mean we’re only talking about placing <!– text –> spanning more than one line of code.. it works if its just a single line but not if its more than one. I tried copy/pasting it from another text editor and it still will not take it. The editor converts the angle brackets <, and >, into the html number.

    What jherrington had originally suggested was to connect to your site via FTP, that way you have access to your entire servers files, but most importantly the .php files that encompass your templates.

    Within the php files you’ll find all of the code that pulls in the necessary sections to create the page, along with some PHP functions.

    Maybe we are mis-understanding what you are trying to achieve. I guess, first question would be where exactly is this code? Inside of the content editor, in a widget?

    If its either of those, WordPress allows you to comment out code using the <!– method, but only when the code spans a single line. If your trying to comment out multiple lines, you’ll simply need to wrap each line in <!– –>, so for examply you would need to do:

    <!-- <h2>TEST</h2> -->
    <!-- <p>This is some more random text that sits -->
    <!-- just below the site header. If the code spans -->
    <!-- multiple lines, we just wrap each line in  -->
    <!-- the comment. -->

    unfortunately there really isn’t a better solution from within the content editor or the widget areas. From within an actual .php file, you can span it across multiple lines without any issue.

    Hopefully that helps somewhat.

    Evan

    the text sits in the actual wordpress editor, it does not appear in any of the templates. you can take a look at this page online: http://events.latimes.com/spiritsofthetimes/

    This is just odd to me, maybe it used to be possible or maybe it is a version issue (using ver 3.6 here) If that should be the case then I can raise the issue with the head administrator, and I doubt they’ll go for upgrading fearing problems across the many sites and pages in existence.

    The one other solution I have come across (dont mind sharing) is that there are a couple of plugins out there such as Enable RAW HTML, or Preserved HTML Editor Markup. Others have suggested going into the function.php file and placing code that prevents wp from stripping comments. If any readers have any experience with any of these plugins then by all means let me know yay or nay and I can forward the recommendation.

    Personally, I don’t think it’s wordpress stripping out any excessive HTML as I believe administrators (by default) are allowed to post unfiltered HTML.

    I think it’s just the way WordPress parses it’s code. I mean , realistically you shouldn’t need to comment out any large blocks of code from within the content editor. You’d want to handle that directly in the php file, or just simply remove the block of code for now.

    Is there some issue with commenting out each line individually? Is it an extremely large block of code or something?

    Also in regards to still using 3.6, I would show your sys admin this page:
    http://www.cvedetails.com/vulnerability-list/vendor_id-2337/product_id-4096/version_id-151648/Wordpress-Wordpress-3.6.html

    Let them know using any out dated version of WordPress is a horrible idea, and a great way to get your site hacked 🙂

    Hi Evan.
    I had already tried logging in as admin before I started this thread and the results were the same. This is definitely a wordpress issue. I found a few other threads with ppl having same issue but none had posted a resolution and thats why I am here. Please do a search if u dont believe me.

    Once again there is no text in any php templates. Several pages are created using a few templates, all variable text data etc is entered in the editor just like any other wordpress site. That block of code was removed just to make the request work for now but that is not a definitive solution, the banners etc will be re-implemented at a later date and it is inefficient to have to continuously delete/re-paste code, or to even comment-out code one line at a time. It would be optimal to have a placeholder to just turn on/off when needed. This is a simple operation that is obviously facing a glitch somewhere in wp.

    I do agree with upgrading 3.6, and yes it is a big security risk. If anyone who has had this problem AND was able to find a solution please dont be shy to post here.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Multiple line Commenting out not possible’ is closed to new replies.