The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
11 views

What's wrong with wp_filesystem delete()?

I noticed something odd recently, the wp_filesystem delete() doesn't work in many cases, and surprisingly, wp_delete_attachment actually doesn't even use wp_filesystem, but uses unlink. What is the ...
0
votes
4answers
92 views

Why cant the WP Filesystem API read googlefonts.json?

I've inherited a site built with a theme by Highgrade (southcentral) which is built using the Redux framework. I'm seeing the following error in the frontend and admin panel: Warning: Invalid ...
0
votes
0answers
20 views

Deleting files and directories with theme activation hook

Has anyone got some insight or good resources for a function to delete the standard plugins and themes upon activation of a custom theme? There does not seem to be a whole lot of info on the topic and ...
0
votes
1answer
57 views

Use WP_Filesystem to list files in directory

Is there a way to list files in a directory using WP_filesystem instead of something like: function listFolderFiles($dir){ $ffs = scandir($dir); echo '<ol>'; foreach($ffs as $ff){ ...
0
votes
1answer
51 views

Copy and delete a directory with WordPress functions

I have successfully used copy_dir() to copy a directory to a new location. How can I delete a directory using WordPress functions?
3
votes
1answer
80 views

Convenient way to use wp_filesystem

I'd like to use $wp_filesystem which seems to be the recommended way to manipulate file system objects in WordPress but compare this: plain PHP code: mkdir('abc'); WP Filesystem API code: $url = ...
0
votes
1answer
95 views

WP_Filesystem in custom customize control

I'm currently trying to edit the following file so it uses the WP_Filesystem methods instead of direct PHP filesystem calls: google-font-dropdown-custom-control.php My current code looks as follows: ...
0
votes
0answers
57 views

how to create or rewrite files in wordpress plugin folder

i'm developing my own plugin. in that i used a simple php file to generate contact vcards in the plugin folder. for this i used fopen & fwrite. but the file is not creating in the plugin folder. ...
0
votes
1answer
35 views

How to display dialog box to save file from wp_filesystem->put_contents function?

I have this fragment: if(!$wp_filesystem->put_contents( $file_path, $file_content, FS_CHMOD_FILE )) { echo 'error during creating the file'; } This code works properly, but instead of saving ...
0
votes
1answer
90 views

Copy a file from a plugin into my theme directory

I coded a wordpress plugin using php's 'copy()' to copy a file from my plugin directory to my theme directory, but it's not working: <? function file_replace() { $plugin_dir = ...
0
votes
1answer
78 views

How to include form for WP_Filesystem()?

I've used a bit of code to try and write a dynamic.css file to a theme folder and it works fine. BUT, it doesn't work on certain shared hosting situations so the request_filesystem_credentials() ...
1
vote
1answer
285 views

Convert PHP readfile to WP_Filesystem

In the script below, I need to convert the readfile to the WP_filesytem equivalent. However, I can't find same in Codex. Any help much appreciated. This script saves the settings.ini file to the ...
0
votes
1answer
207 views

Call to a member function put_contents() on a non-object

I have a plugin and I am creating a css file in wp_content. I used this: $this->content_dir = WP_CONTENT_DIR . "/some_folder"; $path = $this->content_dir . 'options.css'; $css='some string'; ...
0
votes
0answers
9 views

Permanent names of attached files required

Simple: How to delete uploaded file ? Secondary: How to replace uploaded file and to keep its filename (inclusive the path) and all links (inclusive on the whole internet!!!) the same?
2
votes
2answers
636 views

Using wp_filesystem in Plugins to store customizer settings

I try to fix my plugin with the answers i got here: Using wp_filesystem in Plugins Background i wrote a theme (https://github.com/bassjobsen/jamedo-bootstrap-start-theme) and a plugin ...
0
votes
1answer
156 views

Enabling XSendFile causes 404 for images on Wordpress Multisite / Network

I've compiled and installed the XSendFile module and added the following lines to my .htaccess: XSendFile On It shows up as being activated in <?php info() ?> under loaded modules. The ...
0
votes
0answers
27 views

Page Not Found when file does exist

We are having an issue where although files are listed in File Manager they will not pull up when we link to them. We are on the current version of WordPress and all plug-ins. Here is a link to a ...
1
vote
2answers
594 views

Converting fopen/fwrite operations to WP_filesystem

In the function below, I'm trying to convert the fopen/fwrite/fclose methods to the preferred WP_filesystem methods. Everything works as expected using the commented out script block, however, the ...
0
votes
1answer
340 views

Using wp_handle_upload() to direct specific path by using $overrides

How do you use wp_handle_upload function and apply_filter together to upload files on a specific path? What is going to be the override? For example: $overrides = array('file' => ...
1
vote
1answer
194 views

When to use the Filesystem API? Should I use it at all?

I'm wondering when it is recommended to use the Filesystem API, and whether it's useful at all? WordPress seems a little inconsistent when it comes to Filesystem API usage, it uses the API only in a ...
0
votes
1answer
104 views

Unable to access WP admin

I cannot access admin via: http://example.com/admin or http://example.com/wp-admin Fatal error: Class 'ObjectModel' not found in ...
0
votes
2answers
242 views

How do you use unzip_file() successfully?

I have been trying to use the unzip_file() function. It says "undefined" so I looked into it, and the WP_Filesystem() must be called and set up. So easy, right? require_once(ABSPATH ...
0
votes
0answers
67 views

How does WordPress access theme and plugin files through its editor?

I love that WordPress enables you to edit files in the WP back end, but I want to know how it works. How is WordPress able to access and allow you to edit files that are on a server like that? Please ...
0
votes
1answer
633 views

Upload PDF and other files from the Front-End

I am trying to create a medical website, where logged-in doctors can actually upload pdfs and other files (such as jpg) from the front-end in posts. Then, after reloading the page, the uploaded files ...
0
votes
1answer
418 views

why there is a large file named core in wpmu's directory?

why the file named core is here? can i delete it? ls -lh total 37M -rw-rw-r-- 1 hugemeow pg 16 2012-03-04 04:22 a.php -rw------- 1 hugemeow pg 30M 2012-10-16 10:41 core // this is the large ...
5
votes
2answers
473 views

How to use WordPress HTTP API to download file from remote location

So this PHP code works for me: $ch = curl_init( TCS_CPDF_REMOTE_ZIP ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $data = curl_exec( $ch ); curl_close( $ch ); ...
3
votes
1answer
183 views

What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?

I'm trying to implement caching using the filesystem so i need to check if i can write in a directory. I've read Otto's article, but i've failed to understand how should i implement a check where the ...
5
votes
1answer
365 views

Which filters or actions to use after a media upload and delete?

When a media (image) is uploaded and the subsequent images are created (all the different sizes), I would like to perform a few actions. It is simple and I basically need only the new attachment ID, ...
0
votes
2answers
5k views

Moving wp-content outside of web root?

Is it possible to move the entire wp-content folder outside of the Web root? I need to prevent anyone to view any asset file (images, pdfs, movies etc) with a direct url to the file... Any ideas? Or ...
2
votes
1answer
384 views

What is the best way to move a plugin´s subdirectory+files to wp-content/uploads-directory?

I am developer of the plugin Leaflet Maps Marker (http://www.mapsmarker.com - "Pin, organize & show your favorite places through OpenStreetMap, OGD Vienna or any custom WMTS-map") and have one ...
0
votes
1answer
1k views

How to check if txt file exists inside template folder?

I have a folder inside my theme where I hold some txt files which I am including in a theme. The problem is that before including txt file I need to check if it does exist. I fail checking it the ...
2
votes
2answers
2k views

Where is Featured Image code stored in WP?

Well, I'm looking for source code of these two small containers (PHP backend, HTML frontend & JS used to attach the image): I want to build a theme option based on Featured Image code, but I'm ...
4
votes
3answers
2k views

Creating directory in uploads - wp_mkdir_p() or WP_Filesystem?

I don't think I ever had practical need to create folders/files in WP before, but for a plugin I need cache (for resized images) folder in wp-content/uploads. Which raises the question - do I really ...
0
votes
2answers
388 views

Upgrading WordPress (File permission group owner)

I have a problem when i want to upgrade Wordpress or install plugin via the Admin. It's say that I don't have the permission to write. but I can upload images and other things... but i cannot install ...
0
votes
1answer
577 views

$wp_filesystem returns NULL. What are the dependencies?

I need to obtain a reference to the $wp_filesystem object. In the test below, the var_dump($wp_filesystem) returns NULL. What additional files are required in order to properly set up $wp_filesystem? ...