The shortcode callback function should always echo its output, not return it. Your code should be something like this:
function wcal_abandoned_cart_id_shortcode_callback( $atts ) {
$atts = shortcode_atts( array(
'post_id' => get_the_ID(),
), $atts, 'wcal_abandoned_cart_id' );
echo get_post_meta( $atts['post_id'], 'wcal_abandoned_cart_id', true );
}
add_shortcode( 'wcal_abandoned_cart_id', 'wcal_abandoned_cart_id_shortcode_callback' );
If the output of your callback was HTML, besides echoing, you could just write your HTML outside of the PHP tag.
Related Posts:
- Adding Custom Fields for Img in Posts
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- Redirect to another page using contact form 7? [closed]
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- Update all posts automatically when using post_meta
- PHP Deprecated: Non-static method should not be called statically
- Update Multiple Post Meta for the Same Post In One call?
- How To Ignore a Filter On Applying Filter the Content In a Function
- Calling function from within functions.php returns unwanted value
- how to display all posts Custom fields dynamically?
- shortcode doesn’t work
- How to get custom field image url of specific size
- Can’t get custom posts of taxonomy to show
- Add multiple attributes to product from php
- Make the checkbox meta field checked by default
- Shortcode to generate and save password in a file
- get shortcode value
- Storing Options in a Shortcode
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- How to put JQuery/Ajax inside shortcode?
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- WordPress function not being called from jQuery method
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- Nested shortcode functions accessing variable
- Some code in shortcode function being ignored
- How to Create a shortcode to this php function
- What is @Action in WordPress?
- Custom shortcode for displaying user based on a role parameter
- Return multiple values in a shortcode attribute
- Is there a way to convert shortcodes to html content?
- Shortcode not working – quotes seems strange
- Get all the URLs of the pages that uses a specific shortcode
- Add the_post_thumbnail_url to a shortcode in function.php
- Echo out element to another page.
- Adding a Tag Parameter / Filter to My Shortcode
- grab or load text on demand
- How to create repeater field manually, without plugin (ACF Pro)?
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- need to find duplicated meta value in custom filed and view the posts that have the same value
- How to get current cart values using WC_Shortcodes?
- How do I use a plugin’s shortcode attribute value in another function?
- WordPress hide post from custom post-type on a single page
- Why does my custom plugin only function correctly once per page?
- Hide content for specific users with id
- Why is my shortcode not working?
- Get Shortcode output to database for static post_content
- Custom Field used to allow a Free Story; no longer works
- Get and Update Most Meta Value as an array in HTML form
- How to pass multiple custom fields as shortcode’s parameters
- How to get post that has non zero or greater than zero meta value
- Problem with conditional woocommerce custom checkout field
- Same Title on two different post type with single custom taxonomy
- Query Shortcode from a multisite to appear on a different site?
- Find all strings between an enclosing shortcode
- Creating a user ‘add custom field’ section
- Posting code inside the post instead of in the template file using shortcode
- How to Set Limit with WordPress Get Bookmarks Shortcode
- WordPress User Frontend Editing Custom Fields
- ACF: Hide a div or template section when a custom field (in a field group) is empty
- Creating Features List in WordPress Post
- Integrate Razorpay quick payments plugin with contact form7 plugin
- cURL External API request displays content above other content on page
- Subtract Using GravityWP Count Plugin
- How to get URL param for pagination in shortcode?
- qTranslate‑X is not translating all shortcodes
- Fields are not displayed on front end under custom php code in Advanced Custom Fields and Flexible Content field WordPress
- Custom Dynamic Tag in Elementor not showing image
- How to override plugin function in code snippets WordPress
- How to make a Template page to show the information of different things Shop and Product page?
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- Split Million WordPress Post’s Into Multiple Database Server
- How to create a “Most Popular” & “Latest” TAB in WordPress
- Is there any WordPress Plugin that provides video editing from front end side? [closed]
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Creating a Table Row by Row
- Getting 504 Gateway Timeout Error on AWS Server! [closed]
- Order custom post type by posts with most likes first
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- How to fix template and image buffering issues on website [closed]
- WordPress issue – data is not showing in wp-admin, but when searching through database, all the data is there
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- PHP FATAL ERROR
- WordPress Throwing Deprecated Errors on its own Files
- public custom posts not showing in my wordpress plugin
- Problem with a shortcode generating a error [closed]
- Use inline callable for hooks and filters
- How Create LastMod and Update Date Only on Taxonomy Category and Tags
- Error in using ‘admin_enqueue_scripts’ action through a class
- Shortcode Displays 2 times
- How to execute a shortcode within a custom field?
- plugin doesn’t retrieve data from database
- I want to allow certain file types on dokan upload files
- How to create different woocommerce single_product.php pages for each product? [closed]
- Accessing Correct Database to Create REST API Endpoint
- How do I replace a logo image that’s hard-coded into a plugin’s logo.php file?
- additional fields based on the quantity of products selected
- Display file contents within Plugin