Why function hooked using object are executing at all time?

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>’; }