dirname( STYLESHEETPATH );
That will return the theme directory.
Never assume /wp-content/
below ABSPATH. I’m using often a different directory and domain for wp-content
to enable cookieless requests to theme files. Bad plugins and themes break terribly in such cases.
Addendum
Or use get_theme_root()
for the file path and get_theme_root_uri()
for the URI. Both are defined in wp-includes/theme.php
.
Related Posts:
- Objective Best Practices for Plugin Development? [closed]
- How can I add an option to the Page Template list from a Plugin?
- Using composer for dependency management in plugindevelopment
- What is nonce and how to use it with Ajax in WordPress? [duplicate]
- wp_mail is undefined
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- Build path for a custom portfolio plugin
- How to save block attributes when the output doesn’t change
- add_filter and remove_filter added before and after wp_query
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- How to: Rest endpoint returning empty object
- Ensuring a plugin is loaded/run last?
- How can I hook into existing WordPress Bulk actions?
- Scheduled event does not run at midnight
- Plugin options table,is the data serialized
- creating elements/innerblocks via rangecontrol
- How to check if current static page is frontpage from admin plugin
- Woocommerce add custom button to backend order table
- Converting theme widgets to plugins?
- Sample — test — data for large WordPress install
- Earliest WP Hook to Safely and Reliably Redirect
- What is rich_editing?
- How Can I setup WP CLI on Windows development machine running AMPPS?
- WP_LOCALIZE_SCRIPT doesn’t work
- JS / JQuery form validation in backend admin menus
- Is using register_activation_hook required?
- What method to use to call a REST API?
- Is it possible to delay execution of shortcode output callback?
- Why my database table not created on activation?
- wp_enqueue_script + wp_enqueue_style Since When
- How to send email in wordpress with more than one attachments
- Resizing Images for a Gallery-Plugin?
- Which themes do you use to test compatibilities with your plugin [closed]
- How to debug a unit test for a WordPress plugin, which uses wordpress-test?
- Is there any way to allow a plugin to write over a previous version?
- How do i validate data entered in a meta box so that only floats can be entered in a field?
- Adding functions to hooks from within a class
- Modify users.php page to create page/post on button clicked
- Is there an action like ‘after_register_custom_post_type’?
- What filters to call to modify the output of the entire page?
- get_current_screen() return null
- Frontend language per user
- Tried in different ways but sidebar not working?
- How to get results of subcategories also?(WP Rest Api v2)
- How to Create a Simple Related Posts Plugin
- How to run a function on plugin’s options page?
- What stylesheets are available in core?
- dbDelta using Foreign key not working on update [duplicate]
- Help With Rewrite_Rules For a Custom Plug-In
- Theme Install using a Custom Repository
- Activate User in Code (BuddyPress+bbpress)
- Plugin widget zindex changes depending on theme [closed]
- error ‘The package could not be installed. No valid plugins were found.’
- Search: how to extend the existing search to include a custom table
- Plugin development: delete options when updating to a new version
- Is there documentation reference for forms in menu and setting pages?
- Custom code for WordPress dynamic menu
- Plugin templates vs Parent Theme
- Translate MCE button text/tooltip in custom plugin
- wpdb->prepare and mysql UPDATE – how is it done?
- Codex Version Focus on Production or Nightly?
- Make a plugin page out of influence of the theme’s style
- plugin_dir_path wrong url
- 400 Bad Request, in wordpress theme development, wp_ajax
- Return Value of load_plugin_textdomain
- Special Formatting for WordPress Plugin Description?
- Multiple array for post_content on plugin activation
- Using AND and bracket grouping in SQL not working
- Check if the current user is author of first comment
- custom wp_editor does not save the content in plugin settings
- How do I force a download in the admin area?
- add_action wp_ajax_ not loading in plugin file WP Network
- How Can I Add Code To A Preexisting Function Without Editing it
- Change the behaviour of a button
- Login page too many redirects
- Configuring Xdebug with docker compose
- escape html in jQuery for WordPress
- Progress bar in plugin within admin
- Jquery php request is returning a weird result
- WordPress admin panel not working
- Load script on frontend from widget plugin
- Can’t get wpColorPicker to work in a widget
- Get the current post/page URL with plain permalinks
- ajax multiple Values
- Change Label of custom post type
- admin-ajax.php returns “No Script Kiddies!” sometimes
- Ajax functionality not being called under wordpress plugin
- Plugin outputs content of posts unbidden!
- Add a description/hint field in the admin page of a plugin
- Client Profiles
- Saving multiple fields as array
- Serialized Data
- Can’t add images in wordpress to my page – button isn’t clickable
- Gutenberg and custom blocks messed up pagespeed score. What did I wrong?
- Gutenberg text field validation
- I don’t understand how symlinks in plugin work
- Undo operation not working in Rich text [Gutenberg]
- Update custom settings field in plugin
- URL rewrite parameter lost (add_rewrite_rule)
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed