Why doesn’t WP_PLUGIN_DIR definition use DIRECTORY_SEPARATOR?

Whilst writing some code that backs-up a plugin, I hit a problem with ‘the wrong kind of directory slash’ on my windows dev environment. Tracking it through I find in default-constants.php:91 define( ‘WP_PLUGIN_DIR’, WP_CONTENT_DIR . ‘/plugins’ ); which is based on the following in default-constants.php:46 define( ‘WP_CONTENT_DIR’, ABSPATH . ‘wp-content’ ); and hence to the … Read more

Retrieve Path of admin.php

Is there a better way of retrieving the path of admin.php and the url of wp-admin.css? What I can think of is: $adminphppath = ABSPATH . ‘\wp-admin\admin.php’; $admincssurl = get_bloginfo(‘wpurl’) . ‘/wp-admin/css/wp-admin.css”; But, some may be changing the admin path for security. So I need a more reliable way. [Edit] I need the system path … Read more

Hook filter to change wp_upload_dir() path in multisite

The upload directory and URL paths are stored in the options database. You can change them using update_option(): update_option( ‘upload_path’, ABSPATH . ‘/path/to/uploads’ ); update_option( ‘upload_path_url’, site_url( ‘/uploads/’ ) ); However, if it’s a blog site on network multisite, the function _wp_upload_dir on /wp-includes/functions.php add /site/id_blog/ after the url defined on upload_path and upload_path_url. function … Read more

Absolute Path (ABSPATH) in WordPress is not working

I am currently working on a small task that store a plugin information into database, but I have problem regarding to include the file that has the functions to run the query. Here is the line that includes the file: require_once(ABSPATH . ‘wp-admin/includes/upgrade.php’); but I got the following when I run the code: Warning: require_once(ABSPATHwp-admin/includes/upgrade.php): … Read more

How to get WordPress to save upload file beyond web root [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for WordPress Development Stack Exchange. Closed 5 years ago. Improve this question I am using nginx on a multisite install. I am trying to get WordPress to save uploads to a folder beyond … Read more

Which method is best to enqueue scripts

I’m currently authoring the development of a plugin for wordpress, and I’m having trouble figuring out which would be the best way to add scripts to the plugin. I’m in the process of adding more scripts, and I already have JQuery (through WordPress), JQuery UI (through googleapis). Eventually I’ll be adding SWFUpload, but before I … Read more