I have a template file and that file has two get_template_part().

ie,get_template_part( 'store' );

get_template_part( 'header' );

these two are used inside a template page, I wanted here to remove these two get_template_part() from my plugin

ie, if I load a function from my plugin ,get_template_part('store') must not be shown.it should be removed from the template page.

can anyone please suggest some ways to do it.

  • There is no filter for get_template_part(), but what you want may be achieved by replacing the template itself from a custom plugin. This answer has some related details. – Fayaz Aug 29 '18 at 10:28
  • To be clear: The answer to that question requires that the original theme be changed. If you want your plugin to remove template parts from themes you don't control, that's not possible at all. – Jacob Peattie Aug 29 '18 at 10:51

Unfortunately it's not possible. There just aren't any filters for filtering templates loaded with get_template_part() that you could use to achieve this.

| improve this answer | |

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