• Resolved rughjm

    (@rughjm)


    Hi. Thank you for this plugin. I can already tell it is going to save me a bunch of time.

    I am trying to copy the data in title field to the alt text field. I followed your guide here and was able to get it to work.

    However, some of the titles include “-” and I need those replaced with a simple space. I am using template:[+post_title,replace( '/-/', ' ')+] in the EXIF/Template Value field. This removes the “-” but does not insert a space. I have tried other variables in the “r” argument and those return just fine. I also copy and pasted the code in the documentation directly and it also does not return a space.

    For a simple example, ,replace( {‘/,/’ ‘/-/’}, {‘ ‘ ‘_’} ) will change commas to spaces and dashes to underscores, while ,replace( {‘/,/’ ‘/-/’}, ‘ ‘ ) will change both commas and dashes to spaces.

    Are you able to help me figure out why a space is not being returned?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your positive feedback, your question and for the details of your template; very helpful. You have encountered two small defects in the current MLA version that do not handle “spaces” in the replacement value.

    I have uploaded a new MLA Development Version dated 20210717 that corrects the problem. You can find step-by-step instructions for using the Development Version in this earlier topic:

    PHP Warning on media upload with Polylang

    Once the Development Version is installed you can verify that the template you’ve developed is handled properly.

    The fixes will be in my next MLA version shortly after WordPress 5.8 is released. In the interim, it would be great if you could install the Development Version and let me know if it works for you. Thanks for alerting me to this issue and for your interest in the plugin.

    Thread Starter rughjm

    (@rughjm)

    It worked! Thank you very much.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for testing the Development Version and confirming the fix.

    I have released MLA version 2.96, which contains the fix for this defect. I am marking this topic resolved, but please update it if you have trouble with the new version. Thanks again for your help with this issue.

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

The topic ‘Issue adding space with regular expression’ is closed to new replies.