The tag has no usage guidance.

learn more… | top users | synonyms

8
votes
6answers
3k views

Where to store PHP files created by plugin / themes

There are cases in which a plugin or theme needs to create a php file somewhere that can later include it. For example a captcha plugin, or some kind of a templating system like twig/smarty (In my ...
6
votes
3answers
3k 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 ...
5
votes
1answer
77 views

Do WordPress Core Filenames Work as Hooks?

This is in reference to another answer here on wordpress.stackexchange. The answerer used the filename as the hook to enqueue scripts and styles to certain pages. add_action( ...
4
votes
1answer
83 views

add/apend templates 'transparently' via plugin to currently active theme or child theme?

Cross posting my trac question here in the slim hopes that someone here has run into the same issue and has already come up with some proof of concept code I can try: In building a custom 'theme ...
3
votes
1answer
241 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 = ...
3
votes
2answers
448 views

Is there a WP Way of getting a filehandle?

I'm using an external CSV reading library that takes a filehandle (resource) as an argument. I'm using wp_handle_upload() to actually process and store the file in the Uploads directory, but that ...
3
votes
2answers
817 views

How to configure WP filesystem access in Linux (Ubuntu Server)?

Ubuntu Server, LAMP stack, freshly self-installed WordPress. Apparently I can't use direct filesystem access method because files are owned by different owners (WP core unpacked by me and files WP ...
2
votes
2answers
5k views

delete uploaded file

I have a function wp_handle_upload() for uploads files. $file = $_FILES['attachment_icon-' . $i]; $upload = wp_handle_upload($file, array('test_form' => false)); what is a function for delete a ...
2
votes
2answers
2k views

sanitize attachment filename

I'm looking for a way to sanitize the filename of user uploaded attachments. I thought that wordpress already did it but I faced preblems after an user uploaded an attachment containing a '°' . That ...
2
votes
2answers
414 views

How do I maintain static directories on multisite subdomains?

I'm trying to migrate from multiple subdomain blogs to WP multisite. The one stumbling block is that I'm pretty sure the static files and directories on my subdomains will not be found; each of my ...
2
votes
1answer
3k views

Uploading Media gives error “Missing a temporary folder.”

After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media. "Missing a temporary folder" Various articles around the web ...
2
votes
1answer
29 views

What are the hierarchy of filenames while initialising a WordPress plugin?

WordPress has recommended to have the filename similar to the name of the plugin. There is no other information about the hierarchy of filenames of a WordPress Plugin. Also I don't find plugins ...
2
votes
1answer
522 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 ...
2
votes
0answers
142 views

Change default uploads file using wp Skeleton

I am using Wordpress Skeleton (https://github.com/markjaquith/WordPress-Skeleton) which pulls the themes etc out of the wp directory. I am trying to set it up so uploads have a custom url (eg: ...
1
vote
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 ...
1
vote
2answers
2k 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 ...
1
vote
1answer
91 views

Placing assets for external use

I'm developing a plugin, that is meant to work on external requests to a wordpress site. The plugin will generate a .json file, and will come with 2 default .css style and 1 .css file that will ...
1
vote
1answer
761 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? ...
1
vote
1answer
769 views

Merging PHP download script into `functions.php`

I run a large mixtape download site on WordPress. I'm currently developing a new theme and I'd like to include as much site functionality into the theme's functions.php. For serving the downloads, I ...
1
vote
1answer
281 views

Is it bad to store many files in a single folder?

I upload thousands of images and it stored in a single folder. Is it bad if too many images are in a single folder? would that slow down the loading of the image even though you're viewing an ...
1
vote
2answers
72 views

What permissions should I give directories if I want to make WordPress more secure?

A follow up to a previous question found here How can I lock down an old wordpress install I don't intend to update? Same info still stands. WordPress install will (probably) not be updated. ...
1
vote
1answer
130 views

Where do I save widget code for wordpress?

Pretty simple, I've written a widget and I can't find out for the life of me where to save it?! Using the most recent version of wordpress. Thanks, John.
1
vote
2answers
1k views

Running WordPress as FTP user?

I've been doing some research on file permissions as of late, as my WordPress installation on my VPS doesn't have write access. From what I've heard it's very dangerous to make the apache user the ...
1
vote
1answer
76 views

How to implement filesystem cache in Wordpress

I'm currently using the Transients API to cache some product details from Amazon. Now I'm looking into adding a file system cache. But I have no idea how to implement it. The only thing that I can ...
1
vote
1answer
889 views

Interface for logged-in users to upload/download files

I am setting up a site for a non-profit that would like to have a 'members' area where certain users can swap files for meetings, events, etc. They essentially need a simple interface where they can ...
1
vote
1answer
2k views

List of files/folders writable by the web server?

New to WP. I soon realized there are some files that need to be writable by the web server, otherwise various operations fail. Moreover, the lists seem to be different for different tasks. Not sure ...
1
vote
1answer
356 views

Necessary user, group and permissions for core updates

What user, group and permissions of files and folders I need for core updates? Test setups I tried everything the manual recommended me to. Here are some test setups I used, the setup was ...
1
vote
0answers
45 views

Securing a multi-user permission structure

I'm currently working on a team that needs two distinct users from the same wpadmin group to be able to modify the wordpress files. Following the guide at Hardening WordPress (Codex), the following ...
1
vote
1answer
438 views

Alternative to file_get_contents() for theme operations

My theme options page needs to write to the style.css file in order to store updated theme settings. To do that, I'm using file_get_contents() and file_put_contents() However, theme-check plugin ...
0
votes
2answers
3k views

Is fopen() forbidden in WP?

I badly need to create an .XML file inside my theme every time user comes to my site. But I can't. This code in header: <?php $ourFileName = "testFile.txt"; $ourFileHandle = ...
0
votes
1answer
1k views

How to edit php code in WordPress Post file?

I have a wordpress page. In that wordpress page, user will have access to the following Window to Publish their Post in to the webpage. If the user enters an URL in any of the three filed I have ...
0
votes
1answer
51 views

Running rmdir function on post save

How can I make wordpress call this function when a post is saved? $folder = "/temp/files/"; //path of the folder to be removed function delFolder($folder) { foreach(glob($folder . '/*') as ...
0
votes
1answer
37 views

Page to show a link to every file in an directory

I have a file on my server with a large number of PDF files in it (more than 100) and I wish to have a page on WordPress that shows a link to each of these files (say sorted alphabetically by the name ...
0
votes
2answers
163 views

Why does WP load so many files in the head of source code? How do I optimize it?

I have noticed that wordpress loads a bunch of files into the head of a site. This looks really sloppy and discloses vital information about the file structure of a website. Depending how many ...
0
votes
3answers
605 views

Uploading non-media files?

I want to add files on WordPress that are non images, embedded video and the like. However when I try this using the upload media feature I get the following error. "File type does not meet ...
0
votes
1answer
79 views

How to convert the file path to a URL of the same file?

How do I convert file system path to URL? I have found some general PHP solutions that can be error prone. Is there some WordPress specific way to do it?
0
votes
1answer
50 views

get_template_directory() returns wrong address on VPS

I'm having the following problem with a Wordpress installation on a VPS server. I'm trying to read from a JSON file but the returned address from get_template_directory() is wrong: $url = ...
0
votes
1answer
49 views

How do you clean a filename after image sideloading a url that contains `%20`?

Right now I'm creating a plugin to sideload images from an external source. The UI allows me to select files on the external server then downloads them via AJAX & media_sideload_image. ...
0
votes
1answer
53 views

Correct file permissions for in-browser updates using WP-CLI

I installed WP using WP-CLI (i.e. on the command line on the remote server). I'd like to give another person the ability to change the theme, plugins, etc. using the standard WP admin browser ...
0
votes
1answer
112 views

Generating and downloading files with WP API

Lately I was challenged to implement functionality that would allow users, editing specific custom post, to download json file based on meta of that post. I finally managed to complete the task (well, ...
0
votes
1answer
297 views

Why do I get undefined function export_wp()?

I'm trying to create a function in functions.php or a plugin to generate an export via a cronjob, similar to how Chris_O did this question. However it seems that I can't call export_wp(), I keep ...
0
votes
2answers
1k views

wp-config.php file permissions

I have installed Wordpress on my local Ubuntu machine, with standard LAMP configuration and phpMyAdmin. The installation directory is localhost:///var/www/blog. At the second step of the ...
0
votes
1answer
2k views

Image URLs stopped working due to Permalinks?

I've been changing my Permalinks and changing my site the the "www" version (Which I think has broken my image and video links). All my images are "red x" now, both inside the library and the posts ...
0
votes
2answers
3k views

Standard permissions for wordpress; Plugin installation asks for FTP credentials

I'm on a server that does not have FTP installed and will not have FTP installed. I have another website that I've been able to install plugins in before, including the one I'm trying to install now ...
0
votes
1answer
2k 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 ...
0
votes
1answer
59 views

WordPress HTTP Error on File upload

I have increased the max_file_upload_size from 20 MB to 100 MB in WordPress, but I've been facing a problem since then. Whenever I try to upload a file of any type, it says "HTTP Error" when I use ...
0
votes
0answers
49 views

Can't Install WordPress (local) Failed to open file wp-includes/wp-db.php

Title kinda says it all. Trying to install WP locally and I get the following error when trying to use the wp-config.php generator UI: Warning: mysqli_real_connect(): (HY000/2002): No such file or ...
0
votes
1answer
35 views

FS method direct on NGINX

WordPress is a great CMS but when it comes to debugging and error reporting it becomes pretty annoying. I've been searching a solution for my problem for quiet a while now. Unfortunately without any ...
0
votes
0answers
58 views

Avoid 'uploads' 777 permissions: Potential threat or clean solution?

Recently changed hosting of a website and found the upload directory of WordPress wasn't "available". I have been reading that setting folder permissions to 777 would allow everything to work fine, ...
0
votes
1answer
38 views

Should I use Filesystem API for reading files or listing directories?

I know that i should use Filesystem API to write files and I understand why but is there any difference if I read file with wp_filesystem or plain PHP? And what about listing directories? Consider ...