Site posts and pages displayed instead of plugin template pages

I am using WP “single_template” & “archive_template” hooks for rendering plugin’s own single and archive pages.

My plugin is OOP based. First, I added both filters in class constructor then my plugin users detected that their website posts and pages are displayed instead of plugin pages.

Read More

Here is the code:

  // Filter the Single Page Template
  add_filter( 'single_template', array( $this, 'get_single_template' ), 10 , 1 );

  // Filter the Archive Page Template
  add_filter( 'archive_template', array( $this, 'get_archive_template' ), 10 , 1 );

Then, I wrapped these filters into “init” hook, this issue reproduced.

Is this issue happening to due to other theme’s/plugin’s conflict or I am making any wrong call to these filters.

Any help will be appreciated.

Thanks!

Related posts

Leave a Reply