This behavior is most likely intended, and can be disabled. However it might break other features too. There are a couple of workarounds, that you can try.
Break the Image URL and File Name
You can pass the arguments to your shortcode in the following way:
[theimg
path="https://s.w.org/about/images/logos/"
filename="wordpress-logo-simplified-rgb.png"
]
This will prevent the editor from parsing the URL, but you can get the values and put them together in your PHP code.
Use preg_match()
So, the editor converts the URL to a full HTML image? Fine, let him do it. After the editor passed the full image to the shortcode, we can use a preg_match
in our PHP code to extract the URL:
preg_match( '@src="https://wordpress.stackexchange.com/questions/290646/([^"]+)"@' , $img, $match );
This will parse the $img
content and return the src
of the <img>
tag.
Related Posts:
- How to manually fix the WordPress gallery code using PHP in functions.php?
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Shortcode created to check language not works
- Add/echo div with Analytics-Code to function in functions.php
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- How can I default to all WordPress roles when parameter is not included in shortcode?
- WordPress menu deletes when trying to add a hook
- Wrap each shortcode in array to div
- Recent post display using shortcode
- Nested shortCode functions in the functions.php file
- Making Quote Plugin more efficient
- Placing raw HTML inside a WordPress shortcode
- Settings API – sanitize_callback is not called and it leads to an incorrect behavior
- Shortcode content output but not in correct place
- is_page “range” for if statement?
- PHP code inside shortcodes
- Shortcode content filter?
- Trigger popup in a php if/else statement
- How to output a PHP file values by shortcode?
- Showing content from one page on another
- How to display posts by current user in a drop down
- Get value from shortcode to do something
- Custom shortcode outputs plain text instead of HTML at top of post
- Pass php dynamic variable to shortcode
- How to Reference/Echo Variable from Another PHP Function
- Remove echo from shortcode
- Shortcode with PHP issue “Undefined index”
- Shortcode from a function not working
- Display Data in Table from External Database in WP using Shortcodes
- Is it possible to return content, and then also continue to do other things?
- ::before on open/close function [closed]
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Creating WordPress Shortcode with Variable
- Shortcode to find and replace URL
- Help with WordPress function inside a shortcode
- calling a custom field value inside functions.php
- List all blogs, but exclude the main site
- Shortcode to embed Edit Account form not working
- Shortcode for Listing Users from Meta Value?
- Cant display an image via PHP in wordpress
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Function sanitize_title() does not appear to be working
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- AJAX function not working [closed]
- Updating Metadata with Shortcode
- Display logged in user name and lastname on page
- Create shortcode for metabox gallery
- Display Visual Composer shortcode if a post belongs in specific categories
- Why is the current page loaded in the pop-up window and not the specified one?
- How do I reopen the (Popup Maker) after entering the correct password for a password protected page?
- Block error message in foreach loop when looping through ACF field
- How can I prevent a shortcode div from extending beyond its boundaries?
- PHP multiple forms, same page, isset($_POST[]) not working?
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- wpdb->query returns different value to phpMyAdmin
- shortcodes, custom php and their errors
- Display a custom name when the user has no name settle in his account
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Display current user metadata on WordPress page
- Reload page with a different shortcode when a user selects from a dropdown
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Offset with ajax load more posts duplicates
- Get posts by id using shortcode
- Shortcode’s output to use as other shortcode’s parameter
- Open/closed function [closed]
- Need to Echo A Url path to show on a wordpress page
- Wrapping shortcode content in a span or link
- Need help with PHP functions
- How to have Function of a plugin using global vars into a shortcode?
- Overwriting a Shortcode
- Shortcoding with Divs
- WP Debug enabled Undefined index error in a widget
- Whats wrong with my code? Need To add String to shortcode? [closed]
- My title is showing after the shortcode
- A next page function with shortcode?
- Shortcode to include PHP file, pass various parameters to include?
- WP Custom tables query
- Display terms on product page with shotrcode
- How call WordPress shortcode inside function file
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)
- Show only IF not Google bot [closed]
- How the functions in WP are called in tags
- Woocommerce – remove product from category
- WooCommerce: How can I get orders with a custom ID in order meta data object?
- Modify function to print tags/categories/exclude tags/categories/ number of posts
- how to enqueque code in a php file from functions.php
- Convert all uploaded PNG files to PNG-8 format
- Uses for function: wp_update_user
- Populate Posts based on category selected using AJAX that means without page refresh
- Why transition_post_type hook is called twice for the same post?
- Can’t get_users info by using json_encode
- Page returning ID from array, how to return the correct values for post in acf wordpress
- Permission error on plugin save
- Removing all my hardcoded URLs with get_site_url()
- Highlight main menu when on specific posts or pages
- Adding Gravity Form With if(is_page) Is Not Working
- WooCommerce: write featured image dimensions to custom fields in product’
- transition_post_status hook, works – but not if the post is new