Wordpress wp-load.php

前端 未结 6 1179
花落未央
花落未央 2020-12-10 03:00

I\'m trying to reverse-engineer a plugin : http://wordpress.org/extend/plugins/wordpress-social-login/

In a part of it, there\'s this line:
(I\'m having a hard t

6条回答
  •  甜味超标
    2020-12-10 03:25

    wp-load.php is one way to load WP from external scripts, allowing the use of WP functions among other features.

    But, as you say, that should not be necessary as it is a plugin. Nevertheless, you don't explain where did you find the code in your question, because wp-load.php is indeed needed for front-end pages or scripts located in a directory different from the style sheet directory, for example, even when they are part of a plugin.

    Plugin pages in the admin area don't have to reload WP because it is already loaded, but front-end pages do have to load it.

    In short, there are several reasons to include wp-load.php to have access to WP functions and variables.

提交回复
热议问题