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)
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Where do I put the code snippets I found here or somewhere else on the web?
- How can I make add_image_size() crop from the top?
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- How to remove WPML Generator Meta Tag by theme’s functions.php (override plugin function)? [closed]
- Define Function in functions.php or plugin and call in theme loop
- Autogenerate wordpress shortcodes using array?
- Way to force media uploader use custom image size
- WooCommerce create new product and add to cart on form submit
- How do I make my wordpress page more friendly for mobile viewers?
- Change destination author link
- Shortcode under a Shortcode Multiple times Possible?
- How to call a plugin function in footer.php
- Upload images from custom plugin using the media modal
- Over write plugin templates
- How to show category images (from plugin) on a regular page (page-example.php)?
- How to create Repeater fields using Advanced Custom Fields?
- Saving/Writing/Adding file to upload folder
- Override plugin functions in functions.php
- Suspicious google tag manager
- Using has_filter with a class based plugin to check whether the plugin is active or not
- ajax front-end increment views on click
- Display a text message if the field is not found and not if found
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- Add a plugin before main container
- Get all categories of custom post even not assigned
- Function to prevent users from trashing comments
- How to make a custom field as an editor in wordpress?
- How does WordPress process plugin installations?
- How to create TEMPORARY Download links in a wordpress POST?
- Conditionally add apt. Open Graph meta data to different pages on WordPress site
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Bootstrap Drop Down menu is not working
- Set featured image randomly from WordPress Database on post submission
- How Do I Figure Out What File(s) to Edit from Looking at the Source Code [closed]
- Custom random quote widget breaks when used in multiple sidebars
- How to change constants in WordPress wp-config.php programmatically?
- Override Plugin Script Fucnction in WordPress
- How to call WordPress function other files
- How to upload WordPress Images to remote web server and display those images in WordPress gallery [closed]
- Conditional attributes and logic per product category
- Bulk Image Upload And Rerrange Functionality
- Paid Membership Pro with ACF [closed]
- Plugin that will let me specify a number of image sizes?
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Send email with list of active plugins upon activation/deactivation
- Using custom fields for image alt and title
- Where Should i write the code for wordpress ajax voting?
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- Add action to custom Function
- Help with a function in a widget
- how to convert XML from URL to HTML
- Apply a Meta tag to one page only
- Get all image in media Gallery with alt/title?
- Alternative Hook to the_content for Changing Background Color
- Unpublished Pages Failing To Appear On Custom Path
- Post source link plugin – small modification
- How to add specific script to WordPress webpage that will working with user input and databases
- Why Custom fields description is not working WordPress Version 5.4.2?
- Block plugin update possibilities (but not by hiding notifications)
- Execute function activate/deactivate plugin in specific pages
- WP_get_image_editor resizing images in a foreach loop
- Plugin function in child theme
- Change the color of ACF Subtitle output background
- How to make cover image in post block expand to entire screen?
- Soflyy WP All Import Custom File Download Issue
- Why isn’t my plugin seeing other classes?
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Contact Form 7: custom validation [closed]
- functions.php conditional output for a single plugin
- How to declare this function correctly?
- How to Add Extra Text In WordPress Title Before Post Publish
- A way to upload old html pages with all its assets via WordPress admin and to add a fixed menu on top of those (a la Wayback Machine)
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- WordPress Convert queries to slashes using function.php
- add to cart linking to add to cart page
- Edit Image button disappears when I make WordPress use Imagick instead of GD