skip to Main Content

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


  1. Dont use plugins_url. Try this:

    include plugins_dir_path("/imp-file/admin/partials/imp-file-admin-
    display.php");
    
    Login or Signup to reply.
    1. Create a structure that defines plugin path variable in your base class:

      define( 'XPlugin_PLUGIN_PATH', plugin_dir_path(__FILE__) );

    2. and then use it like a param from your include function as follows:

      include( XPlugin_PLUGIN_PATH. '/admin/partials/XPlugin-admin-display.php');

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search