Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!



Return current template, if the plugin rendering is currently inside the template. This is useful to determine which template is used, and based on that perform some other things.


If it is inside the template, returns an array with parameters:

  • method: name of the current rating method
  • type: list or single
  • list: list of potential templates plugin tried to load
  • name: code of the template
  • file: name of the template file
  • folder: the path to the folder where the template is located
  • path: full path to the loaded template

If it is not inside the template, return WP_Error.

Rate this reference

You are not allowed to rate this post.

Leave a Comment