Use plugin_dir_url( __FILE__ );
for the URL and plugin_dir_path( __FILE__ );
for the path.
Pass the plugin’s main file to both functions to get similar results.
Besides that, ADMIN_PATH
and ADMIN_DIR
are really poor names for custom code. They might result in collisions with other code in the future. Try to use better names, something with a unique prefix.
Related Posts:
- What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- Use theme constants in plugin?
- Many Single Sites, One Plugin directory – adjust plugins_url()
- How to include wp-load.php from any location?
- Correct way to enqueue jquery-ui
- How to echo the_excerpt without the P tag wrapper?
- How can I update a wordpress plugin from a Git repository (github)
- Is There a Plugin Life Cycle Documentation?
- What is an alternative method to the WordPress private _doing_it_wrong() function
- Shortcode adding p and br tags
- Custom frontend page for plugin without a ‘physical’ page?
- Using AJAX in a plugin to submit form – REALLY confused
- Plugin Architecture/Design Pattern – is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?
- Problems with localization
- Install and load additional plugins when running unit tests
- Having Problem On Getting WP Post Gallery Images URL
- Post added via wp_insert_post with category doesn’t show in category listing
- How to get an image transferred via FTP or script to appear in Media Manager?
- plugin_dir_url() adds path to url
- Does settings API create settings on run time?
- Nuance in adding CPT and TAX to a submenu
- Where should I store global data for my multi-site WordPress plugin?
- wordpress 3.0 json issue
- How to allow core Gutenberg blocks selection only when you are inside a custom inner block
- Print value of an array or variable in a payment plugin
- How to extend expiry time of jwt wordpress token?
- Coding a plugin on WordPress; when should I sanitize? [duplicate]
- $wpdb -> Batch insert from XML File?
- Settings not set after calling register_setting()
- wp_count_posts on all post types?
- preprocess_comment array doesn’t have comment_ID
- Conditionally Remove a nav menu link if session is active
- $content variable – Is this a reserved variable for a WordPress function? – php / wordpress
- WP REST API V2 – Add user data to response
- Applying OO patterns and principles to plugin development
- Include content of file into plugin (ob_start();;include;ob_get_clean()) without
- How to schedule a cron job in plugin without waiting for page load request?
- Is it possible to change a term slug before being saved to the database?
- How To Change Logout Screen Title
- onclick post title in admin area javascript file not working
- How can I edit commit messages in my wp-hosted plugin repo?
- Getting List of all registered Dashboard Widgets
- Why does wp_remote_post returns an empty body response on certain endpoints?
- Replace youtube embed in wordpress
- Adding dropdown list to tutor lms registration form
- Where to write custom logs in WordPress
- How developed with version control word press site on shared host? [closed]
- Admin – Handle data before creating or updating a post, page or custom post
- How to Bind one post object Type with other postobject Type in Advanced Custom field [closed]
- wp_redirect on base wp-admin and login
- add_settings_field Data not passing to Options Page Like it should
- Valid filenames for add_action’s first parameter
- What to hook into to check a value before a post is published?
- Correct syntax for database inserts from plugin?
- How to add a gradient component to a custom block
- wp_schedule_event() set daily, but processed every second
- Can’t get AJAX call working in custom plugin
- Empty Pdf file generated with FPDF library in WordPress plugin [closed]
- $wpdb->update() always need a second try
- Why aren’t some plugin styles loading when I load a template?
- How to create custom dynamic url
- Pagination not working with custom wp_query
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- My plugin won’t create table in wordpress 3.5
- Remove Permalink Meta Box not working?
- WordPress actions for plugin admin UI page
- wp_insert_user keeps echoing values
- Getting posts by taxonomy
- Pause plugin option page until all data manipulation is complete
- can members have multiple registration using the same password?
- Modify custom block plugin without losing content
- Exclude Woocommerce Product Category From Sitemap
- apply_filters() and call_user_func() to define and call a function outside a class
- How to show only the last two categories in a menu?
- HTML Elements in my WP Plugin being generated in JS. Security and Translated Text Question about this method being used
- howTo let wordpress endpoint return html-page
- User meta query using Wildcard
- use a (Polymer) web component within a plugin (or theme)?
- how to add security questions on wp-registration page and validate it
- wp_ajax add_action fuction won’t fire on custom jQuery action
- wordpress4.8.2 Multilingual Plugin
- Customize WordPress Admin Menu
- Dedicated server and WPDB Class : huge slow-down of the website
- $wpdb how can i save my postmeta table before querying it
- Create dedicated page with custom template showing custom data
- How can I see a varibles value when my plugin runs?
- Add Button to TinyMCE Custom Menu
- How should I use wpdb class to submit a form in admin dashboard?
- WordPress plugin: admin-ajax.php not passing data to custom function
- Create pages for authors
- How do I create Widget within plugin that uses its own class?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- How to design WooCommerce-like admin tabs for plugin settings page?
- Woocommerce: block user removing cart item
- How can I dynamically change title and description in WordPress?
- Fetch Custom Woocomerce filed data and check the data avialble in Wp-user table as nicname or username using function.php
- How to get locale within WP REST Request?
- How to add extra EXIF data when images are uploaded?
- How to boost WP custom post REST API GET queries by custom taxonomies