How to Pass ID through Short Code

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #36
    monday digital
    Participant
    How to Pass ID and fetch post meta data through Short Code like [my-shortcode id="12"] ?

    My code is like below.

    add_shortcode( 'my-shortcode', 'shortcode_function' );
    
    function shortcode_function( $id ) {
    
        //I would like to get $id value 12 here   
     
        return $id;
    }
    
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.