Support » Fixing WordPress » wp-load.php file does not work

  • Hi,

    I am developing a plugin and using ratchet chat library in that. So, I want to save each new connection against current user so getting logged in user id like this:

    require_once ('../../../../wp-config.php');
    require ABSPATH . '/wp-load.php' ;
    global $wpdb;

    $user_id = get_current_user_id();

    But this does not return real user as returns 0, 0 for every thing while if I try to open my file in website it prints all data perfectly fine.

    Can any body tell me where is the issue or am I doing some thing wrong ??? Help me please …

    Thank You

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Akram ul haq

    (@kamig478)

    I have tried almost every thing but no luck so far … so kindly make sure I can make this done as soon as possible and would be really thankful to you guys …

    Hi, I have found the fix, based off yatich his reply in a different thread.
    First of all get a brand new wp-load.php
    https://github.com/WordPress/WordPress/blob/master/wp-load.php

    Replace that with your current wp-load.php, then go into your cpanel, and go to files.
    Now inside files you select wp-load.php and change the permission from 644 to 444.
    If you are using directphpmyadmin make sure you select wp-load.php and DESELECT “move to trash” and type 444 in the number slot and click change permission.

    This should fix your issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp-load.php file does not work’ is closed to new replies.