문제

I want to run my plugin files in browser

but it shows me the page is not found

When I hit the below URL it shows page not found

http://domain.com/wp-content/plugins/myplugin/test.php

if I put the file out of wp-content folder it works

Like http://beefinc.co/test.php

but I need to run it through the myplugin folder

if this is possible through .htaccess

please let me know what are the changes i need to make

my .htaccess file code is below

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

How can i do this

올바른 솔루션이 없습니다

다른 팁

Allowing your wp-contents folder to be reachable through apache is a security risk.

I would recommend that you find a better way to test your plugin, such as writing a unit test with PHPUnit or split it out of your wordpress install and test it on your own machine in the browser.

That said, you can add a RewriteCond like so:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/wp-content/plugins/myplugin/test.php
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Never run your plugin files in browser. Use admin-ajax.php instead

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top