• Hello. I am trying to call a php file from an ajax query. Everything works fine , but when i try to include a file path in my code with require_once in any way it will never work.

    I try to use the full path which will work when i use it in javascript but not in php. my php code looks like this.

    <?php

    require_once(‘https://www.mysitename.ca/wordpress/wp-admin/login1.php&#8217;);

    ?>

    login1.php is a blank php file.
    Im lost please help, this is so simple but i cant get it to work. thanks

Viewing 1 replies (of 1 total)
  • Hey johnboyman,

    The path for the require_once needs to be from the perspective of the server. So you probably want something like this:
    <?php require_once( get_home_path() . 'wp-admin/login1.php'); ?>

    Just as an FYI PHP won’t execute on the client side it’s server side only.

    Hope this helps!
    –AJ

Viewing 1 replies (of 1 total)
  • The topic ‘require_once doesnt work at all’ is closed to new replies.