Support » Fixing WordPress » WP automatically tags in my posts !!!

  • Resolved idagency


    Hi everyone,

    I have a blog powered by WP, and weekly I add a post about webdesign.
    At the end of the post, I am used to put several links (about 10 external websites I like).

    I put the link like this at the end of the post :

    And WordPress automatically adds a <p> tag for each link, so I get this on the page which is seen bu the user :

    It really looks not nice and I would like to avoid it, but at the same time i don’t want a list with ul and li tags.

    I tried to disable my plugins, one by one, but nothing has changed, it seems it comes from WP itself.

    If anyone could help me, it could be great, thanks in advance.

Viewing 15 replies - 1 through 15 (of 20 total)
  • You could change the method you use, and you’d avoid the paragraph issue.

    Here’s what i would suggest..

    Open up your theme’s template file (whichever file usually displays your post or posts), inside the loop check for custom field, if it’s present write out the links, something like this..

    $_ext_links = get_post_meta( $post->ID, 'show_links', true );
    if( $_ext_links ) :
    <!-- Your HTML links code goes here -->

    Then for each post you want to display the links for you simply give that post a custom field named show_links and give it any value, 1, yes, ok, or whatever you like… simply don’t give the post that custom field if you don’t want them displayed.

    Of course you don’t have to use the name i’ve chosen, you can give the custom field any name you like, show_links just seemed appropriate.

    —- Or alternatively —-

    Wrap your links in a wrapper element inside your post like so..

    <div class="external_links">
    your links here

    NOTE: You’d need to use HTML mode to add the HTML.

    Then update the CSS (style.css of your theme) to remove the paragraph margins on paragraphs that exist inside the above element external_links..

    .external_links p { margin:0; }

    Two different approachs, hope that helps.. 🙂


    Thx for your answer.

    However, I am already using a plugin external links which automatically target _blank the links and avoid more work on my side to create the link on the URL.

    I disabled it, and it didn’t fixed the issue.

    I will try your 1st solution anyway and get back to you

    I am sorry mate,

    Both solutions don’t work.
    I think it’s linked to WP itself, cause when I paste the links in the editor, there are no <p> tags at all, it’s WordPress which add them.

    Even when I check the post through admin when it’s published, I don’t see the <p> tags, even through the HTML tab of WP.


    Where do the links come from, do you type them into the post? If Yes (and assuming you’re following the second approach), all you need do is switch to HTML mode when you write them in, and write this before the links.

    <div class="external_links">

    Then write this after..


    NOTE: It doesn’t matter you can’t see the paragraph tags at this point.

    Then add this to your style.css (at the bottom preferably).

    .external_links p { margin:0; }

    And that should do it.. (can you link to a page where you have a post with these links?)

    NOTE: Both will definately work when applied correctly, if you’re having problems applying the suggestions, don’t worry, that’s exactly why i’m here.. 😉

    Thx Mark,

    I am used to WP and I can say you your solutions don’t work !
    I modified the CSS sheet, add the div tag into my posts, but it doesn’t modify the link behaviour.

    I don’t write the links directly into the editor, I post them !


    *I paste them

    Post them where?, if they’re not put into the editor, then WordPress wouldn’t be wrapping paragraph tags around them.

    Could you post a link to a page where you have these links, or alternatively post the code from the relevant file that displays these links (in a pastebin please).

    I can only base my suggestions on the information you give me, which thus far has given me the impression that the links are pasted into the editor directly, if that’s not the case i would appreciate some clarification (or to see the code, or a link to a page with the links).

    Yes yes, they come from editor 🙂

    *link removed per request*

    Check this page, at the end I have added two links.

    Notice that I disabled the plugin external links, which normally creates the links itself

    So when you write a post, at the end of the post you put the text.


    NOTE: The hxxp is to stop the forum converting them to links.

    Where’s the DIV tag you added in? Or did you not add it on that post?

    Would you mind adding it back, so i can test the CSS?

    Alternative: You could try this as a simple solution, when writing the post, instead of hitting enter after the first link, hold Shift down, then hit Enter.. which should cause WordPress to generate the code like this instead.



    Here I added 2 links, but I am used to add 30/40 links sometimes.
    So the br tag solution is not very easy for me, it was working fine before but now I have this paragraph tag all the time.

    But I think I can describe the issue with new elements I discovered studying this problem :

    Actually, when I add my links, I add the URL but not the link itself, the plugin “External links” does it for me.

    So when I post WP consider the links as texts (because they are not linked), and add a paragraph tag for each of them (because there is one link per line), that’s why the page is displayed like this.

    Then, the external links plugin does its job and add the links themslves on the page.

    So I might modify something in the plugin or in WP to avoid this.
    Perhaps it’s not possible 🙂

    Thx again for your help, and let me know if i can do something to fix it.

    Then, the external links plugin does its job and add the links themselves on the page. –> but the paragraph tag issue remains 🙂

    As far as i can test, both the suggested solutions do work (for me, using the same version of WordPress)..

    The CSS and DIV solution is easy and it works (it’s basic HTML and CSS – i’ve done similar things hundreds of times), but i can’t see why it’s not working for you unless you add the DIV into one of the pages and provide a link (the one above is fine if you want to add the DIV in for a few minutes), so i can see why it doesn’t work “for you”..

    If you’d like me to help you solve the problem, that’s great (it’s why i’m here), but please decide which approach you wish to take and stick with it, it’s not easy to help if you keep changing you mind about how to approach the problem.

    I’m here if you need me.. 🙂

    Thx again,

    Both solutions will fit my needs so i am ready to take one of them, even if i have a preference for a solution like the 1st one, where i can avoid to add the div in my editor.

    Anyway, I have tried your second solution (CSS) and apply it to the page cited above, and i am sorry to say but it seems it doesn t work.

    Thanks again for your help.

    I can see the DIV element in your page (great), but unfortunately you havn’t added the style i posted above into your theme’s stylesheet.

    Looking at your site quickly i did realise the CSS needs a little adjustment, but all the same you do need to add it to the stylesheet, it’s not currently there.

    Open up your theme’s style.css file, and place this at the bottom.

    (is the file you need to place this in, just to clarify)

    .external_links p { padding:0 }

    Save, then reload the page..

    If no change, update the code above to read.

    .external_links p { padding:0!important }

    That should do it..

    If you make the adjustment via the theme editor, please pay attention to any messages that appear on the screen when attempting to save, if you site does not have the necessary permission set on your theme’s folder, the changes you make won’t actually get saved (simply keep an eye out for a message when saving changes).

    Hi again,

    The style was added in the CSS sheet but it didn’t work out, i modify with your advices and it works fine now with the “!important” only.

    Thanks for your help, it s great, I will try now something to add it into my theme.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘WP automatically tags in my posts !!!’ is closed to new replies.