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?
- Is there any plugin development framework
- How do I add CSS options to my plugin without using inline styles?
- How to override existing plugin action with new action
- Handling results from data hooked into admin_post
- How do I create links at the top of WP_List_table?
- Why Does get_posts() Return an Empty Set?
- Get list of available wordpress actions
- Where to enqueue stylesheets for plugin?
- How can i list current author’s categories?
- stray elements
- Deletion of shared options using uninstall.php
- Rest Api How to get results of child categories with one api call
- Plugin Settings not Saving on Ajax re-ordered table
- How to store accumulate multiple option values in a single array using Options_API
- Add Post and Comments menu no longer visible
- Undefined function wp_set_password
- Finding the paragraphs in content
- When I deactive WooCommerce Plugin, I want to take a action in My plugin
- Create a custom display order in the main menu
- Override the default Add/Edit site forms of the Network Panel in custom plugin
- add more custom post types and custom role to the code
- Executing a function upon webhook calling wordpress
- A better way to include localized labels in WordPress plugins
- How a deprecated function can crash WordPress site while upgrading
- WordPress Block Development – trouble importing from @wordpress/icons
- Clearing caches on plugin uninstall
- plugin settings – uploading multiple files with a single button
- Adding (blog-specific) links to “My Sites” admin page
- Getting term_id for newly created or edited term
- How to enable sorting in custom media uploader in plugin
- How to insert text at the current cursor position in Gutenberg?
- How do I apply a custom discount to individual product total prices depending on their categories on the cart and checkout pages of WooCommerce? [closed]
- How to fix this URL error in WordPress ” data-wplink-url-error=”true”>
- Remove unwanted elements for a wp_nav_menu
- Edit Images From the Front End without Access to WP Admin
- How to remove or add submenu item on plugin activate or deactive
- how to add stylesheet to particular plugin only?
- Difference between wp_salt schemes
- WordPress daily cron is executing more frequently than once a day
- How can I replace the search results displayed by WordPress?
- What is the best way to store a few fields?
- Remove an action by extending class and replacing it
- I18n not working in plugin
- making a plugin that moves other plugins wp_head actions to wp_footer
- Settings API: Setting default option via ‘get_option’ fails
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- How to redirect to login page when user not loggedin on a particular page
- How do I validate extra pin field on my WordPress login form page?
- How to create a wordpress widget that dynamically changes according to the page
- Non editable custom taxonomy
- How to resize WordPress images on upload to specific height and width without cropping it
- Get section of input passed to the sanitize_callback
- Plugin to create Posts and Forums then choose category and parent forum
- Checking for existing title in custom db query not working
- Adding Permalink to Slides with ‘Simple Nivo Slider’ plugin?
- How to add a new taxonomy link to the admin menu
- insufficient permissions; coding an action for plugin governed by custom capability
- My plugin creates custom widgets, How can I programatically add them to existing sidebar widget areas?
- Include external po file for 3th party plugin to theme
- Adding the image selector/uploader to an admin back page
- setTimeout not working in jquery
- How to know if current plugin is going to be used while rendering the page?
- Dynamically modify content added to table via javascript
- functions won’t fire after I converted my code from procedural code to OOP
- How do I show the HTML descrption in wordpress photo gallery for my individual gallery pages?
- Javascript scroll eventHandler only working when I’m logged in in WordPress
- cancel place order proccess
- CPT UI and custom database table
- How I can give access to my custom plugin for editor roles user?
- Testing Plugins for Multisite
- Updating a WP Plugin SVN not showing on WordPress Website or Zip
- Download stopped working in 4.7.4
- $wpdb Mysql trigger problem
- WP: adding Javascript to specific woo commerce pages
- Calling dynamic_sidebar in plugin gives error
- How to add chunk of php, html, and sql code to variable an append to $content
- edit-tags.php in plugin admin menu hides when is the active page
- WordPress postboxes On Tabbed Views and Hiding Registered Pages
- Best way to handle a form post in plugin
- Yet another wp_insert_post infinite loop. What is wrong?
- Why does this fail: Disabling plugins enqueue_script() in functions.php
- How To Remove The Filter That Adds JetPack Related Content To Dom [closed]
- Fixing plugin for wpdb::prepare
- Remove text from confirmation message
- Can I use an array to create multiple tables?
- Advanced Custom Fields conflicting with custom plugin when saving custom field
- WordPress plugin boilerplate AJAX functionality
- Run different permission_callback depending on HTTP method of custom REST API endpoint