I created a wordpress plugin and I added shortcode feature to it. but i want to execute only one shortcode and prevent applying of multiple shortcodes if the administrator did so.

1 Answer 1


Just remove the shortcode during the first call.

add_shortcode( 'foo', 'foo_shortcode_handler' );

function foo_shortcode_handler()
    remove_shortcode( 'foo' );
    return 'bar';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.