WordPress.org

Ready to get started?Download WordPress

Forums

Slashes Added To Custom Fields (26 posts)

  1. Shyzer
    Member
    Posted 5 years ago #

    I use the custom fields to add country flags to my posts so my readers know if the post is for them or not. After upgrading to 2.6 the other day, I noticed that now WordPress is adding a slash in front of any quotation mark. I can go back and edit the slashes out and they don't come back, but still, I find it kind of weird. Anybody else having their custom fields acting up?

  2. tsguitar
    Member
    Posted 5 years ago #

    I had this problem with apostrophes. I don't know about quotation marks.

    Are you using a Custom Field plugin? I was using a GUI plugin and that's what caused this problem. When I turned the plugin off and entered the custom field info myself, those slashes went away.

  3. Shyzer
    Member
    Posted 5 years ago #

    Hmm, weird. I've got apostrophies in the image alt tags and those are left alone. It's only the quotation marks that get the extra slashes for me.

    And no, I don't have any custom field plugins running.

  4. omgitztrey
    Member
    Posted 5 years ago #

    Mine is doing the same thing.

  5. Shyzer
    Member
    Posted 5 years ago #

    With apostrophes or quotation marks?

  6. dave920
    Member
    Posted 5 years ago #

    I am also having this problem, with random slashes \ being inserted

  7. omgitztrey
    Member
    Posted 5 years ago #

    a quick workaround is to just copy the text you are adding... add the post meta... and then paste over the existing text and click update.

  8. ryanmc
    Member
    Posted 5 years ago #

    I am having the same problem. I enter href tags in one of my custom fields and the link don't work with the extra slashes. This has got to be a bug. Has anyone entered a bug report?

    An example would be this is what I put in
    JusTechn

    and this is what I get when I save the custom field the first time.
    JusTechn

    I can edit them out and re-save, but this is extremely annoying.

  9. ryanmc
    Member
    Posted 5 years ago #

    dang it rendered the links. It should would be nice to be able to preview posts before we submit them.

    hopefully it will work correctly this time.

    before
    <a href="www.justechn.com">JusTechn</a>

    after
    <a href=\"www.justechn.com\">JusTechn</a>

  10. ryanmc
    Member
    Posted 5 years ago #

    I found a bug report for this Ticket #7346. Now hopefully it will get fixed soon.

  11. GrantBarrett
    Member
    Posted 5 years ago #

    I've got the same problem. Very annoying. It happens in every custom field, every time I created a new one, for any post.

  12. Shyzer
    Member
    Posted 5 years ago #

  13. Shyzer
    Member
    Posted 5 years ago #

    Just an update: I've realized now that whenever I add a custom field, it "kills" my Save and Publish buttons. They simply refuse to work. I have to go back to my dashboard, open up my draft, reload the post, and then continue editing it and/or publish it. Highly annoying!

  14. Anonymous
    Unregistered
    Posted 5 years ago #

    Could anyone help me.

    Kindly view my blog http://cheap-alternative-energy.com

    I made my first post.Subsequently when i made my second ost he first one moved to the right.Can anyone find a solution for the same and explain me step by step.

    Atul

  15. Shyzer
    Member
    Posted 5 years ago #

    @atultanna: it doesn't look like your problem has to do with slashes in the extra comment field, so you might want to start a new thread. However, I looked at your site and I think it's simply the theme you're using. You'll need to edit the theme to change it.

  16. Anonymous
    Unregistered
    Posted 5 years ago #

    Hi, I also have a problem with custom fields, I can't edit the posts where I use them !

  17. dave920
    Member
    Posted 5 years ago #

    @ Shyzer : I also have the problem with the Save and Publish buttons -- they stop working when I try to update a Custom Field after removing one of those erroneous slashes.

  18. Shyzer
    Member
    Posted 5 years ago #

    So was anybody lucky enough to find a solution to this?

  19. wp_wired
    Member
    Posted 5 years ago #

    this happens because wordpress escapes the quote characters ' and " and possibly others using a backslash \, i think this is a security measure but since 2.6 at least the $_POST variables are escaped, sometimes this may not be convenient for development

    you can use php function stripslashes() to remove the escape character
    <?
    echo stripslashes($_POST['var']);
    ?>

    thus something like O\'reilly becomes O'reilly

    i would like to know how to deactivate this issue, it forces to implement an extra call to stripslashes() but that may alter the content in other versions

    --wp-wired

  20. Shyzer
    Member
    Posted 5 years ago #

    No fix again in 2.6.2 :(

  21. equaldesign
    Member
    Posted 5 years ago #

    To avoid the slashes problem I tend to code the <a href="http....."</a> into the theme files and then just add the http://www.domain.com part into the custom field box. That solves the problem.

  22. Dgold
    Member
    Posted 5 years ago #

    I have to say, I had this same problem in WP 2.3 or 2.5 (sorry can't remember for sure, I think it was 2.5).

    And I use the same Custom Fields GUI plugin mentioned above (even tho it has not been updated since 2007, it still works).

    I don't have this problem anymore! WP 2.6.1.

    I'm trying to remember what the fix was, or if it just fixed itself. Really, I used to have the exact same problem with slashes, and now I don't have this problem (just tested again to be sure).

  23. Shyzer
    Member
    Posted 5 years ago #

    equal, what exactly do you mean? I add images to my custom fields, not anchor links, so I don't know if that will help everybody.

  24. equaldesign
    Member
    Posted 5 years ago #

    When I add custom fields in the write post panel i usually add something like http://www.domain.com/wp-content/uploads/image.jpg. I.e. this code goes in the custom field box on the page iteself.

    Some people I know have chosen to do it so that they would add the following code into their custom field box on the right post section:

    <img src="http://www.domain.com/wp-content/uploads/image.jpg">

    therefore i would include the following in the template file:

    <img src="<?php echo get_post_meta($post->ID, "key", true); ?>

  25. aborg
    Member
    Posted 5 years ago #

    Got the same problem - as an awful lot of people use custom fields for images and as such should also include quoted alt tags (so changing templates is not much help), I think this counts as a pretty serious problem.
    Been WordPressing from the very beginning and this is the first time I've come across something so frustrating.

    Is there any way to upgrade Ticket #7346 to severity: severe?

    Don't want to sound negative but it seems to have been knocking around, unresolved, for too long. Is there anything else we can do? Work-arounds for something so basic are not really on.

  26. Niemi
    Member
    Posted 5 years ago #

    <?
    echo stripslashes($_POST['var']);
    ?>

    In which file would we insert that piece of code?

Topic Closed

This topic has been closed to new replies.

About this Topic