That happens, because you run the function in add_shortcode(). To send is as callback, use:
add_shortcode('examp_code', array ( $obj, 'ex_funct' ) );
Now you have still a problem: you create output in your shortcode callback. Never do that, you have to return a string.
Change it to:
function ex_funct(){
return '<h3>Hello</h3>';
}
Related Posts:
- How to add a shortcode button to the TinyMCE editor?
- Get plugin_dir_url() from one level deep within plugin
- Custom media upload content for inserting custom post shortcode
- Checking if an attribute exists in a shortcode
- Namespaces in WordPress – How do I initiate the main class?
- enqueue script only if it is not already enqueue
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How To Ignore a Filter On Applying Filter the Content In a Function
- Shortcode display outside the div
- Pass $this to function nested in another public function of the same class
- shortcode doesn’t work
- How to include and use custom class files in plugin?
- How to add inline css/js inside a shortcode
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Current user in plugin returns NULL
- Demystifying and understanding shortcode nomenclature
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- Input with spaces in Shortcode attributes overwritten by defaults
- Allow users of my plugin to define their own shortcode rather than use mine?
- Making a Template for a CPT created by a plugin
- creating html reusable blocks via shortcodes
- Single API call exposed via shortcode with params
- Creating shortcodes in plugin
- How to create a custom shortcode based on the layout?
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- Namespaced shortcode?
- Why is my custom post type not being activated on plug-in activation?
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Why am I unable to load scripts in head in plugin?
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- IF condition based on wp_remote_get output
- Shortcode Attributes to Return different $_POST
- get_option / wp_localize_script Not Working in OOP Plug In
- Built a second plugin but it overwrote the first one
- How to use template inside plugin shortcode with variables for big HTML code
- strange shortcode error: does shortcodes requires any dependency?
- WordPress Object Oriented plugin development [closed]
- How to access OOP plugin function inside themes or other plugin
- How to rewrite URL and get the values?
- Thumbnail image doesn’t show up in Shortcode output
- list of custom post by custom field in frontend
- Shortcode do not return the right data in post
- How to call function in WordPress on button click?
- Hide content for specific users with id
- Why is my shortcode not working?
- WordPress plugin blog creation
- Get post content inside plugin class method
- WP Plugin CSS not being applied to page
- How to access classes in theme of a plugin?
- Modify Plugin PHP Class in Child Theme – Correct Method
- Shortcode in a blog post, footer and related products stop working
- shortcode which is introduced into entry the blog, and appears in side bar
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Shortcode registered from a plugin not recognized
- Any way to hook into WP after a page displays?
- Plugin: Custom menu item problem
- Function not being called on form submit, only blank admin-post.php page
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Display file contents within Plugin
- Is it possible to use Classes between WordPress plugins with separate namespaces?
- How to get next day date of a specific day
- What are the common security flaws I need to look for? [closed]
- Creating a user’s own folder on user registration
- Problem requiring/including plugin files with plugin_dir_path( __FILE__ )
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Deleting images through upload folder, but not deleting from media library
- how to use ajax to display from database and load more in wordpress plugin
- Create or Update thousands of woocommerce products via PHP
- Update Option Error: Notice: Undefined index
- Why this global array is returning NULL from a callback function
- Why my Plugin keeps deactivating automatically?
- How to get current post user id
- Shortcode based chart plugin
- Ajax contact form widget plugin data not insert in database
- Install Plugin via Code
- How to output CMB2 select options from repeated groups select elements?
- SEO Friendly URL on dynamic product page produced via shortcode
- WP All Import – Execute Imports
- do_action() hook into load-(page)
- plugin shortcode output
- WordPress checkbox and Illegal string offset
- Is it fair to use MIT licensed code in WordPress plugins? [closed]
- How to Show Author image and url in WordPress plugin directory? [closed]
- jQuery code didn’t run on my plugin
- how to check if a shortcode is used more than one time in the same post
- Custom Module, Extending WP with a Plugin?
- How do I profit from a Plugin?
- How to properly use wp_mail() in my own plugin?
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- ajax voting for custom post type
- Delete postmeta when uninstall/delete plugin
- Saving an array to get_options
- Plugin keeps saying needs to be updated and it’s in a constant loop [closed]
- Activate plugin button do nothing [closed]
- wp_enqueue_script doesn’t load JS in plugin
- AI Code For OpenAI
- Why WP CLI command is not visible in VIP CLI