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
- How to build an API as a plugin
- Loading shortcode with ajax
- How do I configure WordPress to talk to a Microsoft SQL Server database?
- Nested shortcodes
- Unable to activate wordpress importer after installing it
- Trying to count the total number of paragraphs inside a blog article
- WordPress Ajax Callback
- Saving Custom Post types and fields to a custom table
- How would I go about creating a user ranked post popularity page?
- WordPress: PHP code rendering in the wrong place
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to edit content before post update
- How to create an input field, and base the output on spreadsheet data? [closed]
- Why is one phpunit test throwing an error on one class when all other classes are similar without error?
- Setting Up PHP Workflow in WordPress
- How to use template inside plugin shortcode with variables for big HTML code
- Can you echo PHP code from a variable?
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- How to ignore fields if empty?
- Moving a few select DB tables to a new WP instance
- How to get the total count of Favorite/Favorited authors
- Admin login substantially slower on production server
- redirect to a custom page
- function of parent not working in childtheme
- How to change text in a page by utilizing a custom user id?
- How can I insert a record into a custom table from my custom form in my custom admin page?
- Why function hooked using object are executing at all time?
- Including a PHP file via a function that is part of a plugin?
- Any way to hook into WP after a page displays?
- Translate text for empty product
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- How to override plugin function in code snippets WordPress