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
- How can I see all the actions attached to an “add_action” hook?
- How can I import a class privately into a plugin?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- How to display multiple Post meta_key/meta_values by SQL query
- Updating WooCommerce variable product stock issue
- How can I show drafts in wp_dropdown_pages list?
- How to Create a Directory in a Plugin Folder?
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- HELP: Integrating WP with raw PHP code once published button is hit
- How do I add advanced custom fields / meta fields to Elasticsearch? [closed]
- Loading class files via autoload method
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- bulk change of image setting “link to” to “link to: image url “
- Escape when echoed
- add_meta_box (Will display only in specific page admin WordPress)
- Make id column as AUTO INCREMENT on plugin activation
- Sending email from inside a plugin using PHP PEAR
- How can I create a list of page titles from custom meta values?
- Notepad sticky plugin
- WooCommerce Custom Product to checkout
- How to stop or remove an action being called inside a function of an extended class
- How to simultaneously access the same MySQL database in the main column and sidebar of WordPress?
- Date calculations from 2 custom fields
- Easiest way to add dropdown to a page
- How to enable specific plugin only based around shop manager role?
- Adding a new field to the address field type in gravity forms
- Show admin notice on incorrect value on form field
- WooCommerce specifc variations for specific user role [closed]
- Calling an attribute from a plugin shortcode
- accessing wp.media api from a tinymce plugin
- Visual Composer shortcode for child theme dir