TEMPLATEPATH and STYLESHEETPATH will be deprecated in the near future. It is not safe to rely on these constants. Use get_template_directory() and get_stylesheet_directory() instead.
And wait until the init hook (or after_setup_theme before you use them to be sure all needed files are loaded.
Example for a plugin:
add_action( 'after_setup_theme', 'wpse_50359_set_plugin_basics' );
function wpse_50359_set_plugin_basics()
{
if ( is_child_theme() )
{
// do something awesome …
}
}
Related Posts:
- What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
- get plugin directory url
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- How to check active theme is parent or child wordpress
- Which action is triggered when a theme was modified?
- Can I change header.php of current theme through a plugin function?
- How to make “upgrade safe” theme for a plugin?
- How to modify files inside wp-includes directory in wordpress
- Update Data parameter of a wp_localize_script() call
- Many Single Sites, One Plugin directory – adjust plugins_url()
- Want to know how to reveal a WordPress theme, considering the theme name is hidden?
- What is the “best” way to update a theme via a plugin?
- Load js/css files only on specific admin UI pages
- Which action for triggering cron “wp”or “init”?
- WordPress and multithreading
- Nonce in settings API with tabbed navigation
- Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions
- Using preg_replace to clean widget output HTML
- Removing rules from .htaccess
- What is the best way to provide plugin users with a way to customized the styles
- Mapping multiple URLs to same page
- Add Products to Woocommerce through WP API
- How do I only load js on the post-new.php and post.php pages in admin?
- Check if on Custom Post Type for TinyMCE buttons
- Screenshot are not showing up on plugin page
- Self-hosted plugin update problems
- How to avoid creating first submenu page that is same as menu page?
- How can I display an error message after post has been saved?
- What method to use to call a REST API?
- Best choice of options/settings framework for plugin/theme development
- GET parameters interfere with my plugin settings
- What’s the best place to hire a freelance (contract) WordPress developer? [closed]
- Why my database table not created on activation?
- How to use relative path with my plugins folders?
- Resizing Images for a Gallery-Plugin?
- Files automatically added
- Adding functions to hooks from within a class
- What filters to call to modify the output of the entire page?
- Help With Rewrite_Rules For a Custom Plug-In
- How to add plugin version update option in plugin row action?
- wp_filesystem put_contents issue with owner/group
- Create custom HTML/JS app inside page
- Plugin Development for registered users
- Widget options are not updated
- wp E-commerce featured product plugin with muliple option?
- How to test a WordPress plugin in real time
- How to Trigger WP CRON at Local Timestamp?
- Problem with saving checkbox values with WordPress Widget API
- How to Control CSS of Admin On Creating only a Specific Custom Post Type
- Force download file from plugin (change output http headers)
- How to get all product in the woo-commerce? [closed]
- Check user’s role and store in variable
- What’s the hook for filtering every texts of site?
- Undefined variable’s error when expected to have passed the content of variable [closed]
- Google credentials and redirect URI for Google OAuth2 in a WordPress plugin, questions
- How to add plugin options in wp editor page
- How to add a panel/box/widget/are/screen to the right side of edit post/page confusion
- Service Worker Uncaught (in promise) DOMException
- Issue with plugin sub menu and pages
- How can I programmatically change a MySql variable (foreign_keys_check)?
- Problem with display data from get_option
- WordPress Plugin Boilerplate: Addition of 3rd party scripts and styles [closed]
- How to format custom fields when editing an attachment?
- Screenshots on plugin page taken old [closed]
- Get Posts by IDs (optionally)
- How do I duplicate a single post, with all its properties, and save it as a different post?
- Why doesn’t my Table get created?
- Extract Information from post content (using regex?)
- Using jQuery prepend() with file include
- want to show CMB2 metabox on woocommerce product data tab
- Customise Grouped Product display in Woocommerce with custom column
- Add parameters to 3rd party callback function
- Ajax action has 200 status but response of No response data available for this request
- Google Web Core Vitals – management, how to in wordpress and advice
- Hiding the WordPress login and password fields from login page
- Adding customs fields on each product on the cart
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- Buddypress: adding a new tab direct user to their author page
- Why would one specify multiple arguments when using get_previous_posts_link() which takes only one parameter?
- WC_Geolocation not found inside plugin
- Set widget icon in Customizer?
- I have a plugin where in I have to change the title of the page dynamically by sending parameter to the_title filter
- How can I map a specific URL pattern to a plugin for processing
- Issue on Getting Images URL of the Post Gallery
- What happens when you create/edit a menu
- I can install my plugin in localhost but not in my server
- Change the class of wordpress menu
- WordPress.org how to force expire Cached Banner-772×250 from my Plugin page
- What is the Timeline for the Active Version Pie Chart in the Repository?
- How to change url’s in WordPress when changing domain [duplicate]
- Email verification feature in wordpress social login plugin
- Is wordpress plugin development active? [closed]
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- WooCommerce adds a newline symbol (\n) between email recipients
- How can I chanage the user for the composer container in wp-env?
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Why isn’t custom sidebar panel not showing up in the Gutenberg Editor?
- Ninja Forms: Front-End Forms, Post ID?
- move useState variable from edit.js to save.js. How do I do that?
- Page jumps to top