Skip to content
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

Convert embedded link to plain link? #17312

Closed
paaljoachim opened this issue Sep 3, 2019 · 3 comments
Closed

Convert embedded link to plain link? #17312

paaljoachim opened this issue Sep 3, 2019 · 3 comments
Labels
[Block] Embed Affects the Embed Block [Type] Enhancement A suggestion for improvement.

Comments

@paaljoachim
Copy link
Contributor

paaljoachim commented Sep 3, 2019

Is your feature request related to a problem? Please describe.
I added this link: https://pluginrepublic.com/add-custom-fields-woocommerce-product/
it then embeded itself. So the embedded link looks like this:

Screen Shot 2019-09-03 at 14 21 27

Clicking the pencil/edit icon it looks like this:

Screen Shot 2019-09-03 at 14 40 37

I see no solution in the link module to just add it as a plain text link.

Describe the solution you'd like
I would like to see an option to add a link as a link instead of having to embed the link.

If a link plans on embedding itself then a dialog box should show up asking "do you want to embed the link or show plain link" or something like that. It will give the user an option to embed or not to embed.

Describe alternatives you've considered
I added this code to the functions file:

* Remove Auto Embeds and show just text links. https://easywebdesigntutorials.com/adjusting-the-auto-embeds-of-wordpress-site-links-on-your-site/ */
function disable_embeds_init() {

    // Remove the REST API endpoint.
    remove_action('rest_api_init', 'wp_oembed_register_route');

    // Turn off oEmbed auto discovery.
    // Don't filter oEmbed results.
   add_filter( 'embed_oembed_discover', '__return_false' );

    // Remove oEmbed discovery links.
    remove_action('wp_head', 'wp_oembed_add_discovery_links');

    // Remove oEmbed-specific JavaScript from the front-end and back-end.
    remove_action('wp_head', 'wp_oembed_add_host_js');
}

add_action('init', 'disable_embeds_init', 9999);

Adding the same link now shows this dialog box:

Screen Shot 2019-09-03 at 14 24 50

Clicking Convert to Link shows it like so:
Screen Shot 2019-09-03 at 14 25 54

By adding the code to the functions file I remove all embedding of links and just show them as plain links.

I was thinking this PR was associated with this issue, but I am not sure:
"Allow the user to Convert unembeddable URLs to links and try embedding again."
#12095

@swissspidy @jasmussen @gziolo

@swissspidy
Copy link
Member

The "Convert to link" option exists, but only applies if the content cannot be embedded. In your example, the content can be embedded though.

FWIW, instead of adding that code to your theme I'd just install the Disable Embeds plugin where this code was copied from anyway.

@swissspidy swissspidy added [Block] Embed Affects the Embed Block [Type] Enhancement A suggestion for improvement. labels Sep 3, 2019
@paaljoachim
Copy link
Contributor Author

It should go like so:

  1. User adds an url.
  2. If the url wants to become embedded. Then show placeholder box to where the user can select to embed or have it as a default text link.

Today:
One adds an url. It might or might not become embedded.
If one adds a few links some might be embedded while others not.
This can cause a bit of chaos in the layout as an embedded link looks different then a regular text link. A user would see this as a bug that comes and goes not knowing why. As it would seem random. It would be good to have a consistent way of handling urls that are added to a layout.

@paaljoachim
Copy link
Contributor Author

It looks like I made a duplicate of my own original issue:
#15102

I will go ahead and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Embed Affects the Embed Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants