You have to use do_shortcode()
to execute shortcodes in your string
Full code should be like that
<?php
function my_shortcode( $atts ) {
$atts = shortcode_atts( array(
'post_id' => '', // Default value.
), $atts );
$output="https://wordpress.stackexchange.com/questions/291524/[acf field="image" post_id="" . $atts['post_id'] . '"]';
$output = do_shortcode( $output );
$output="<img src="" . $output . '" />';
return $output;
}
add_shortcode('my_link', 'my_shortcode');
Usage:
[my_link post_id="xxx"]
where xxx is id of the requered post.
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Using Advanced Custom Fields with WordPress and Lightbox
- Generate Advanced Custom Fields box in custom admin menu page
- Disabling post images for not logged in users
- Converting a simple plugin to be placed inside of functions.php
- bulk change of image setting “link to” to “link to: image url “
- Using a post-signup hook to get user details
- Image change on hover
- Adding class to last list item? Not WP generated
- Images under 1MB are not being compressed
- adding Adsense’s In-Article Ads between images of blog post
- Some images on WordPress site are suddenly gone
- Add_image_size not generating correct size
- Elementor Pro display featured image on section -> style -> image using shortcode
- Replace the_content with ACF Flexible Content via function
- ACF Fields are not showing up on Homepage
- make p tag collapsed after 3 rows
- How to wrap image tag into div for post only?
- Get a Taxonomy values in an array
- getting image alt text via ACF plugin in WordPress [closed]
- Option value not getting updated until page refresh in WordPress
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- How can I make my custom shortcode work in a Custom HTML Widget?
- How to handel multiple checkbox field in the admin settings page with Settings API
- wp_insert_user – how to send verification email before logging in
- Post source link plugin – small modification
- How do you auto-activate plugins from child themes
- How to edit plugin’s html? [closed]
- What is the function to get plugin base url in multisite?
- Code in theme functions.php faster than with a plugin?
- How to get CMB2 to show a single image at a specific size
- How to add an attribute to the body tag with a plugin?
- Override the core function locate_template
- Trying to count the total number of paragraphs inside a blog article
- May i Use ShortCode in Template?
- Pass info from functions.php to plugin
- add_query_arg not working
- Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
- Images not showing after changing wp-content folder name
- How to stop or remove an action being called inside a function of an extended class
- How to Delete all Unused photos Function
- Date calculations from 2 custom fields
- How to debug error message: Cannot modify header information
- Adding a new field to the address field type in gravity forms
- Load external images via proxy
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- List the authors that have written posts in a category
- How to get plugin name from plugin file location
- Checking the count within a foreach loop
- Create a post builder skin in a plugin
- Slashes stripped in ACF
- Photo Gallery Plugin and Touch Devices
- Need to replace Currency Shortforms
- add_query_arg not work in admin
- Api external with wordpress
- File Uploader – Upload without adding to Media Library
- How to get rid of Ellipsis on Woocommerce [Essential] Theme [closed]
- Sharing functions between plugins
- Simple sildeshow/image-upload plugin?
- How to validate custom fields in Quick edit/bulk edit?
- Can’t load the the canges of field groups [duplicate]
- implement custom roles in custom plugin
- How to get current cart values using WC_Shortcodes?
- insert og image link in wordpress post
- How to copy the all WordPress media items to another custom plugin folder?
- WordPress default post categories meta box widget
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- Make modification of add_to_cart button specific to single page
- Product Page loads terribly slow when product gallery images are added
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- how can export data in excel file custom plugin
- How to change the width of certain paragraph or header blocks?
- WordPress how do I change images used in plugins?
- Help finding a plugin – masonry type post grid
- WP_CRON issue with UTC and local time
- Update User Meta Via Ajax
- ACF Query result in a new td (echo)
- Unexpected plugin_dir_path Output
- Different body image backgrounds on different pages, posts and categories
- Adding link on title its in description but not in title see screenshots attached
- how to repeat taxonomy in different places on wordpress
- how to create table during plugin installation in side a class
- Metabox Data not saving
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Display alt text as tool tip on page
- Hide/Show panel not showing – ACF
- Including a PHP file via a function that is part of a plugin?
- overwrite a plugin function in functions.php
- Image Layout in Posts
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Trying to disable all notifications except for one on woocommerce checkout page with css [closed]
- Display Video as Post Thumbnail
- Notifications Bar on home page only
- how to embed a crop feature for cropping images uploaded by the user
- Make plugin admin page visible to other roles
- Achieve the following layout
- wp_enqueue_script doesn’t load JS in plugin
- Using ACF to allow user to add and edit multiple saved forms
- How To Convert External Image URLs To Own Website’s Uploaded Images Automatically?