Support » Plugins » Prevent output from get_sidebar() without altering core files

  • I am trying to replace the output of get_sidebar() with that of my own function.

    I know I can tie into the “get_sidebar” hook, which is executed at the beginning of the get_sidebar() function, in order to alter the output. However, after that filter hook is executed, the rest of the get_sidebar() function still runs, and loads a sidebar (which I want to avoid).

    I guess my question is, after tying into this hook and generating some custom output, is there any way to prevent the rest of the function from running, or limit its output in any way?

    Here is a link to the contents of get_sidebar(), where you can see the sequence of the hook with respect to the original function.

    get_sidebar() function

    Any help is appreciated!

Viewing 1 replies (of 1 total)
  • I agree, it would be nice to replace get_sidebar() with your own function. But here are a couple of alternatives:

    – edit the sidebar.php file to do whatever it is you want done in lieu of a sidebar


    – replace the call to get_sidebar() with a call to your own function

Viewing 1 replies (of 1 total)
  • The topic ‘Prevent output from get_sidebar() without altering core files’ is closed to new replies.