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 to disable hover zoom on woocommerce. None of the common methods work
- Replacing global wp_query
- Why can’t I call a (member) function from within a foreach?
- Photo Gallery Plugin and Touch Devices
- Image crop, resize and compression plugin?
- how to insert a HTML form into a javascript popup?
- How to Resize the Custom Post Images?
- Plugin that will let me specify a number of image sizes?
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- How to limit image size for the entire website ? But without editing the post (css/plugin?!)
- Keeping and updating ACF and ACF Pro at the same time
- Adding Plugin Assets to Header
- Any idea how to get something like this to work? [closed]
- Skewed / slanted button within elementor [closed]
- I changed .live() to .on() but change is not reflected on the server
- WordPress Plugin Insert Html Code with Shortcode
- wp_dequeue_script for a Plugin
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- Need to replace Currency Shortforms
- wp_enqueue_scripts
- Return multiple values in a shortcode attribute
- “uagb/section and uagb/columns block”
- get specific value of a array | PHP
- How to get specific string/value from an array? php [closed]
- Shortcode Attributes to Return different $_POST
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Plugin onclick button activate other plugin
- wc_get_template new template does not showing up
- Readable titles in mobile
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- WordPress Stock Update Programatically
- Loading a plugin’s js file from functions.php
- Is there a way to convert shortcodes to html content?
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- the_content() printing DOCTYPE, and tags in the middle of page
- How can I fetch data from another website to my wordpress website with mysql database
- Activate and deactivate plugin automatically
- Plugin for an interactive image? [closed]
- Clear out old images, any advice?
- add_query_arg not work in admin
- Woocommerce singe product custom gallery output works just on the first slide
- Overriding an Array in a Plugin’s Class/Function from functions.php
- Send email with list of active plugins upon activation/deactivation
- How to fix broken media library?
- Using custom fields for image alt and title
- How to accept images at multiple sizes and aspect ratios and display as standardized image size / ratio?
- How do I create a custom permalink structure for a page template
- Where Should i write the code for wordpress ajax voting?
- How to remove a class function from a plugin by using remove_action()?
- How to get images using taxonomy ( WP Media Folder)
- Add “Featured Image” box in my plugin post page
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Large amount image data transfer
- Advanced Custom Fields (acf) – Filter Relationship by Taxonomies not Post Type
- How to translate wordpress error message
- dynamic name of the style for wp_enqueue_style
- Api external with wordpress
- strange shortcode error: does shortcodes requires any dependency?
- All custom widgets are not showing in widget area at the same time
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- WordPress function to add text warning on every pages [closed]
- Blurry images when loading the page first time
- How do I convert my WordPress website to be domain agnostic?
- Get Image Having the ID [closed]
- Change Header (Logo) Based on Login
- Image Galleries for website migrated from .com to .org
- How to access OOP plugin function inside themes or other plugin
- how to change wp-admin url using function file
- Add the_post_thumbnail_url to a shortcode in function.php
- Search by Attachment ID
- File Uploader – Upload without adding to Media Library
- ACF – How to set the menu order for the relationship field
- Wierd site output [closed]
- Add action to custom Function
- Hook for altering the content of all wp mails
- Show media-uploads to all users
- Overwrite add_image_size defined by theme