Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by mi@mgsh.com.cn

Website CMS core file function and loading

Various functions in WordPress are done through its core files (by calling classes and functions in the core files, etc.), and its core files are placed in the WPINC (ie wp-includes) directory, the purpose of these core files, and The order and location of its loading is critical to our understanding of the execution flow and architecture of WordPress.
note: In order to make the thinking clearer and easier to understand, temporarily ignore the files related to background management, and files related to multiple blogs/sites!

Load WP core files:

As shown in the list below, these 42 files are the core of the core files. They must be the core classes and function libraries used by WordPress. There is no executable code, and the corresponding functions will be executed only when called.These files are loaded according to certain conditions in the wp-setting.php file, and their functions are shown in the following list:

    1. WPINC/load.php, which defines a set of functions required to load WP, ​​without executing code;
    2. WPINC/default-constants.php, defines a set of functions that assign default assignments to constants and global variables that can be overridden, they can usually be reconfigured in wp-config.php without executing code;
    3. WPINC/compat.php, which provides functions that are missing in some PHP versions (to support compatibility and porting on different versions of PHP), no executable code;
    4. WPINC/functions.php, defines the main API of WP, no executable code;
    5. WPINC/classes.php, defines the main classes of WP, no executable code.
    6. WPINC/plugin.php, defines plugin APIs, which are used to create action, filter, and hook functions and methods, without executing code;
    7. WPINC/pomo/mo.php, defines the language processing class MO, and loads the file, no executable code:
    8. WPINC/pomo/translations.php, define the relevant classes for translating entry, and load the file, no execution code:
    9. WPINC/pomo/entry.php, defines the translation entity class Translation_Entry, no executable code;
    10. WPINC/pomo/streams.php, defines a set of classes for reading data streams from files, without executing code.

————————I am the basic function dividing line————————
  1. WPINC/l10n.php, defines a set of APIs/functions for language translation, no executable code.
  2. WPINC/formatting.php, defines the main formatting API of WP, which is used to format text, strings, and function output without executing code;
  3. WPINC/query.php, defines a set of WP query APIs, no execution code;
  4. WPINC/theme.php, defines a set of themes, templates and stylesheet functions, no code to execute;
  5. WPINC/user.php, defines a set of WP user APIs, no executable code;
  6. WPINC/meta.php, defines a set of metadata APIs, which are used to obtain and manipulate the metadata of various object types in WP. The metadata of an object is simply represented as a key-value pair, and the object may contain multiple metadata Entities, they have the same key but different values, no code to execute;
  7. WPINC/general-template.php, defines commonly used template tags, which can be used arbitrarily in templates without executable code;
  8. WPINC/link-template.php, which defines functions in a set of templates that handle links (such as handling permalinks), without executable code;
  9. WPINC/author-template.php, defines a set of functions for dealing with authors in the template, these functions are used in the theme, and must appear in WP LOOP, no executable code;
  10. WPINC/post-template.php, defines a set of functions for processing articles in templates, used to obtain the content of the current article in the Loop, no executable code;
  11. WPINC/category.php, defines a set of WP catalog APIs, no executable code;
  12. WPINC/category-template.php, which defines template tags and APIs for a set of directories, no executable code;
  13. WPINC/comment.php, defines a set of WP comment APIs, no executable code;
  14. WPINC/comment-template.php, which defines a set of comment template tags, designed to be useful in Loops, without executable code;
  15. WPINC/feed.php, defines a set of WP Feed APIs, most of which are only used in Loop, without executable code;
  16. WPINC/bookmark.php, defines a set of WP friendly link/bookmark API, no executable code;
  17. WPINC/bookmark-template.php, which defines a set of bookmark template tags, no executable code;
  18. WPINC/cron.php, defines a set of WP CRON (timed task) APIs for event scheduling, no executable code;
  19. WPINC/deprecated.php, a set of deprecated APIs with no executable code;
  20. WPINC/class.wp-dependencies.php, defines classes WP_Dependencies and _WP_Dependency for backpressure script queue, these classes are refactored from WP_Scripts class and WP script queue API, no executable code;
  21. WPINC/class.wp-scripts.php, defines the class WP_Scripts, inherits from WP_Dependencies, the function is the same as above, no executable code;
  22. WPINC/functions.wp-scripts.php, defines a set of WP script queue API, the same function as above, no executable code;
  23. WPINC/functions.wp-styles.php, defines a set of WP style queue API, no executable code.
  24. WPINC/taxonomy.php, defines a set of WP classification methods (different from the concept of catalog, it is a classification on the catalog) API, no executable code;
  25. WPINC/http.php, defines a set of APIs that simplify and unify HTTP requests, no executable code;
  26. WPINC/class-http.php, defines a set of classes that simplify and unify http requests WP_Http, WP_Http_Fsockopen, WP_Http_Fopen, WP_Http_Streams, WP_Http_ExtHTTP, WP_Http_Curl, WP_HTTP_Proxy, WP_Http_Cookie, WP_Http_Encoding, for standardizing http requests, handling cookies and gzip encoding and decoding, no executable code;
  27. WPINC/nav-menu.php, which defines a set of navigation menu APIs in WP, is a newly added function of WP3.0, and has no executable code;
  28. WPINC/nav-menu-template.php, defines a set of template tags and APIs for navigation menus, no executable code.
  29. WPINC/pluggable.php, the functions in this can be overridden by plugins. If the plugin does not redefine these functions, these functions will be used without executable code;
  30. WPINC/pluggable-deprecated.php, deprecated pluggable override function, no executable code;
  31. WPINC/locale.php, the localization object class WP_Locale that defines the date and time, no executable code;
  32. WPINC/post-thumbnail-template.php, defines a set of WP post thumbnail template tags, no executable code.

So far, WP has loaded most of the core files, and the unloaded files in the wp-includes directory are basically third-party library files, abandoned files, or files related to multiple blogs.They will be loaded as needed in the corresponding function:

  1. atomlib.php, loaded in the wp_maybe_load_widgets() function in WPINC/functions.php;
  2. cache.php, loaded in the wp_start_object_cache() function in WPINC/load.php;
  3. class-feed.php, loaded in the fetch_feed() function in WPINC/feed.php;
  4. class-IXR.php, loaded in the xmlrpc.php file; loaded in the pingback() and weblog_ping() functions in WPINC/comment.php; loaded in the do_enclose() function in WPINC/functions.php;
  5. class-json.php, loaded in the json_encode() and json_decode() functions in WPINC/compat.php;
  6. class-oembed.php, loaded in wp_oembed_get() and wp_oembed_add_provider() functions in WPINC/media.php;
  7. class-phpass.php, loaded in wp_hash_password() and wp_check_password() functions in WPINC/pluggable.php;
  8. class-phpmailer.php, loaded in the wp_mail() function in WPINC/pluggable.php;
  9. class-pop3.php, loaded in wp-mail.php;
  10. class-simplepie.php, loaded in WPINC/class-feed.php;
  11. class-smtp.php, loaded in the wp_mail() function in WPINC/pluggable.php;
  12. class-snoopy.php, obsolete, replaced by http.php file;
  13. default-embeds.php, loaded in the wp_maybe_load_embeds() function in WPINC/functions.php;
  14. default-widgets.php, loaded in the wp_maybe_load_widgets() function in WPINC/functions.php;
  15. feed-atom.php, loaded in the do_feed_atom() function in WPINC/functions.php;
  16. feed-atom-comments.php, loaded in the do_feed_atom() function in WPINC/functions.php;
  17. feed-rdf.php, loaded in the do_feed_rdf() function in WPINC/functions.php;
  18. feed-rss2.php, loaded in the do_feed_rss2() function in WPINC/functions.php;
  19. feed-rss2-comments.php, loaded in the do_feed_rss2() function in WPINC/functions.php;
  20. feed-rss.php, loaded in the do_feed_rss() function in WPINC/functions.php;
  21. ms-default-constants.php, loaded in WPINC/ms-setting.php;
  22. ms-files.php
  23. ms-load.php
  24. registration.php, loaded in wp-activate.php, wp-signup.php, wp-login.php;
  25. registration-functions.php, obsolete, replaced by registration.php file;
  26. rss.php, obsolete, replaced by class-simplepie.php file;
  27. rss-functions.php, obsolete, replaced by rss.php file;
  28. wp-db.php, loaded in the require_wp_db() function in WPINC/functions.php;
  29. wp-diff.php, loaded in the wp_text_diff() function in WPINC/functions.php;
  30. pomo/po.php, not loaded? ? ?

At this point, the functions of all core files in WordPress and their loading order or locations are clear, and we can modify (or add or delete) them according to our needs to achieve our own purposes!
Source of this article: www.cnblogs.com/vicenteforever/category/224217.html

Back to Top