i’m trying to create a plugin in wordpress
that’s my code
include plugins_url("/imp-file/admin/partials/imp-file-admin-display.php");
and that’s the warning
> Warning: include(): http:// wrapper is disabled in the server
> configuration by allow_url_include=0 in
> /home/darelizza/public_html/wp-content/plugins/imp-file/admin/class-imp-file-admin.php
> on line 120
>
> Warning:
> include(http://darelizza.com/wp-content/plugins/imp-file/admin/partials/imp-file-admin-display.php):
> failed to open stream: no suitable wrapper could be found in
> /home/darelizza/public_html/wp-content/plugins/imp-file/admin/class-imp-file-admin.php
> on line 120
>
> Warning: include(): Failed opening
> 'http://darelizza.com/wp-content/plugins/imp-file/admin/partials/imp-file-admin-display.php'
> for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in
> /home/darelizza/public_html/wp-content/plugins/imp-file/admin/class-imp-file-admin.php
> on line 120
2
Answers
Dont use plugins_url. Try this:
Create a structure that defines plugin path variable in your base class:
define( 'XPlugin_PLUGIN_PATH', plugin_dir_path(__FILE__) );
and then use it like a param from your
include
function as follows:include( XPlugin_PLUGIN_PATH. '/admin/partials/XPlugin-admin-display.php');