-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't insert a shortcode into the text (line) and as soon as I insert or (paste) it. It becomes a shortcode block in a separate block #60564
Comments
@paulvek Please could update the description to provide more information about what's not working? A couple of sentences really isn't enough info for a dev looking to fix a problem. I clicked through to the link, but it's confusing as there seem to be people taking across purposes about different things. The original issue is that a separate shortcode block is created for inline shortcodes (which seems to have been fixed), then someone seem to be mentioning that inline shortcodes are not processed, so it's hard to understand what the actual issue is. The most important thing is to provide steps for reproduction that will work on a vanilla WordPress site. You can create one locally for free using a tool like local (https://localwp.com/) to check that the issue is definitely a WordPress one and not a plugin issue. |
That's the problem. Although it is mentioned that this problem has been solved, it has not been solved and this problem still exists. I want to paste a shortcode in this line but when pasted the shortcode, the shortcode is pasted in another block and separated from this line. you can see the video I attached. for example, I want to test text with this [acf field="field-text"] shortcode, and another of my descriptions. just as a simple text. wordpress-shortcode.mp4 |
This comment was marked as outdated.
This comment was marked as outdated.
@talldan I think there was a mistake, because I replied right away and attached and sent the additional information requested along with the video! |
This comment was marked as outdated.
This comment was marked as outdated.
Hey folks. |
This comment was marked as outdated.
This comment was marked as outdated.
for me, a recent update broke the behaviour, since WP 6.4.5 or earlier I tried the following plain html. I've not extensively tested the different variations that did and didn't work, but this also happened with existing content ("classic block") when trying to convert to blocks. Before, all of the below were inline, rendered as html in the visual editor. Currently (WP 6.5.5), the last paragraph has a separate shortcode block and shows the contents as plain html in the visual editor. Manually (re)moving the extra tags/elements works, but is obviously a very tedious process. Code editor contents
converted to Blocks
workaround (line breaks between the end of the words and the shortcode don't break the WP paragraph block)
|
in addition, it seems #6250 (comment) is still an issue as well - raw code editor
converted to blocks
pasting
as well as but pasting
|
not sure if the latest Gutenberg is on the latest WP 6.5.5, tested on https://playground.wordpress.net/, issue still occurs both via code editor and pasting Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.[fn]This was copy pasted from a website. Placeholder text is pretty generic, and there are more interesting versions,https://loremipsum.io.[/fn] without p tags - Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups.[fn]This was copy pasted from a website. Placeholder text is pretty generic, and there are more interesting versions,https://loremipsum.io.[/fn]
|
👍 I can reproduce it with that |
From a quick debug, it seems like there might be two issues at play. Firstly if you insert a non-self-closing shortcode (like When copying from the web, often there's inadvertently some html copied with the shortcode. The block editor seems to try to preserve the html as best as possible. When there are non-inline tags, it results in a new block being added. In the case of the first behavior I mentioned (markdown converter), it triggers the second behavior because of the added The second behavior I mentioned can happen completely separately to the first. If you copy a self-closing shortcode (like |
Hi @talldan. In my case, I copy the shortcode from another plugin that I need to be rendered inline because it renders a link. I did the example with Adavanced Ads, but I have the problem with a custom plugin that make the same functionality that I explain in the video. I will be happy to give more feedback or help to find the issue with a little support! |
@soivigol i imagine your shortcode is seen as pasted "plain text", thus running into the first conversion (markdown) @talldan mentions. I tested with @soivigol if it's a self-closing shortcode, you should be able to add it via the code editor, and it'll work as expected I think I'm going to create a work-around using a self-closing shortcode, eg
as this won't generate a shortcode block with "Convert to blocks" an example of a non-self-closing core shortcode is |
@Sandra-headscape Thanks for your clarification. I wrapped the shortcode in a span tag and now, works fine!!! In my case, it's a great solution, because I am using the ClipboardJS to copy with a click. So fine for me. But I think that is not an ideal solution in general why we have a lot of plugins where the user has to copy the shortcode from a list and paste inline, as the Advance Ads. In WordPress 6.4, this functionality worked fine 🤷. @Sandra-headscape @talldan Thanks for your help. In my case, it's working now!! |
I would still like to be able to paste self closing shortcodes into the editor. This change where any pasting of a shortcode auto creates a shortcode block is a real issue for me. I'm using wp 6.6.1. The only way I can get them added is by typing them in. I have almost completely automated system that this breaks 100%... This was working for for me even earlier this summer. |
Yo, I hated this so I built a plugin. |
After rereading this, I'm wondering if because I'm copying from markdown it's triggering the shortcode block insertion? Going to experiment with this this week. I would be surprised though, I use Flycut ( a clipboard app ) and it pastes as plain text so I don't think any kind of sneaky formatting would get past that. |
This problem still exists in 2024. I can't insert a shortcode into the text and as soon as I insert or (paste) it. It becomes a shortcode block in a separate block. And in fact, it should be inserted inline, which is easily possible in the classic editor.
Originally posted by @paulvek in #3806 (comment)
The text was updated successfully, but these errors were encountered: