PageSourceSearch

https://fulltextsearch.org/docs/_next/static/chunks/pages/en/archi…/plugins_loaded-95699671cc1a0626.js

js fulltextsearch.org collected 2026-09-25 21:07:43 UTC 6,893 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4322],{66684:function(e,i,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/en/architecture/hooks_usage/plugins_loaded",function(){return n(50055)}])},50055:function(e,i,n){"use strict";n.r(i),n.d(i,{useTOC:function(){return useTOC}});var s=n(85893),t=n(37812),d=n(80390),o=n(38925);function useTOC(e){let i={code:"code",...(0,o.a)()};return[{value:(0,s.jsxs)(s.Fragment,{children:["The ",(0,s.jsx)(i.code,{children:"plugins_loaded"})," Hook in WPFTS"]}),id:"the-plugins_loaded-hook-in-wpfts",depth:2}]}i.default=(0,t.c)(function(e){let{toc:i=useTOC(e)}=e,n={code:"code",h2:"h2",li:"li",ol:"ol",p:"p",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:i[0].id,children:i[0].value}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"plugins_loaded"})," hook is a standard WordPress hook that fires after all plugins have been loaded. WPFTS uses this hook to load the plugin’s text domain, enabling translation of the plugin’s interface into different languages.  WPFTS also initializes its core classes and functions on this hook, if the plugin core is already loaded."]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["What WPFTS does when ",(0,s.jsx)(n.code,{children:"plugins_loaded"})," is called:"]})}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Loading the text domain:"})," Calls the ",(0,s.jsx)(n.code,{children:"wpfts_load_plugin_textdomain()"})," function to load the plugin’s translation file. This allows using the ",(0,s.jsx)(n.code,{children:"__()"})," function for translating interface strings."]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Initializing the plugin core (if available):"})," Checks if the global variable ",(0,s.jsx)(n.code,{children:"$wpfts_core"})," exists and is an instance of the ",(0,s.jsx)(n.code,{children:"WPFTS_Core"})," class. If so, it means the plugin core has already been loaded and initialized (e.g., through ",(0,s.jsx)(n.code,{children:"wpfts_init_addons"}),"), and the following actions are performed on this hook:"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["Calling the ",(0,s.jsx)(n.code,{children:"WPFTS_Core::set_hooks()"})," method to register hooks related to search."]}),"\n",(0,s.jsxs)(n.li,{children:["Registering AJAX handlers for autocomplete (",(0,s.jsx)(n.code,{children:"wpfts_autocomplete_proc"}),")."]}),"\n",(0,s.jsxs)(n.li,{children:["Registering AJAX handlers for forced indexing (",(0,s.jsx)(n.code,{children:"WPFTS_Core::ajax_force_index()"}),")."]}),"\n",(0,s.jsxs)(n.li,{children:["Adding the ",(0,s.jsx)(n.code,{children:"safe_style_css"})," filter for supporting specific CSS."]}),"\n",(0,s.jsxs)(n.li,{children:["Adding a handler for ",(0,s.jsx)(n.code,{children:"post_submitbox_misc_actions"})," to display the indexing status."]}),"\n",(0,s.jsxs)(n.li,{children:["Enqueuing admin scripts and styles if the request is from the admin panel (",(0,s.jsx)(n.code,{children:"wpfts_admin_menu"}),", ",(0,s.jsx)(n.code,{children:"wpfts_plugin_links"}),", ",(0,s.jsx)(n.code,{children:"wpfts_enqueues"}),")."]}),"\n",(0,s.jsxs)(n.li,{children:["Registering AJAX handlers for internal plugin functions (",(0,s.jsx)(n.code,{children:"wpftsi_ping"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_set_pause"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_hide_notification"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_se_style_preview"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_se_style_reset"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_try_updatedb"}),")."]}),"\n",(0,s.jsxs)(n.li,{children:["Registering AJAX handlers for administrator actions (",(0,s.jsx)(n.code,{children:"wpftsi_submit_testpost"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_submit_testsearch"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_submit_rebuild"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_smartform"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_submit_upgradeindex"}),", ",(0,s.jsx)(n.code,{children:"wpftsi_add_user_irule"}),")."]}),"\n",(0,s.jsxs)(n.li,{children:["Calling ",(0,s.jsx)(n.code,{children:"$wpfts_core->FeatureDetector();"})," to detect WordPress environment specifics (e.g., to display notifications about insufficient memory limits)."]}),"\n",(0,s.jsxs)(n.li,{children:["Executing the ",(0,s.jsx)(n.code,{children:"wpfts_init_addons"})," action to initialize add-ons."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["Important functions involved in handling ",(0,s.jsx)(n.code,{children:"plugins_loaded"}),":"]})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"wpfts_load_plugin_textdomain()"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"WPFTS_Core::set_hooks()"})}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"WPFTS_Core::set_is_settings_page()"})," (used in ",(0,s.jsx)(n.code,{children:"wpfts_enqueues"}),")"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"add_action()"})," for registering AJAX handlers"]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"add_filter()"})," for registering filters"]}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"do_action('wpfts_init_addons')"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"How to use this in add-on development:"})}),"\n",(0,s.jsxs)(n.p,{children:["Add-on developers can use this hook to initialize their add-ons after all plugins have been loaded. This ensures that all necessary WordPress functions and classes are available. For integration with WPFTS, it is recommended to use the ",(0,s.jsx)(n.code,{children:"wpfts_init_addons"})," action, which is called on the same hook."]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"Additional notes:"})}),"\n",(0,s.jsxs)(n.p,{children:["Loading the text domain on the ",(0,s.jsx)(n.code,{children:"plugins_loaded"})," hook is standard practice for WordPress plugins, allowing for translation of the plugin’s interface into different languages. WPFTS follows this practice.  It’s important to note that while much of the plugin’s logic is initialized on the ",(0,s.jsx)(n.code,{children:"plugins_loaded"})," hook, the plugin itself begins much earlier, on the ",(0,s.jsx)(n.code,{children:"init"})," hook, where the ",(0,s.jsx)(n.code,{children:"WPFTS_Core"})," class instance is created."]})]})},"/en/architecture/hooks_usage/plugins_loaded",{filePath:"pages/en/architecture/hooks_usage/plugins_loaded.md",timestamp:1733329702e3,pageMap:d.v,frontMatter:{},title:"Plugins Loaded"},"undefined"==typeof RemoteContent?useTOC:RemoteContent.useTOC)}},function(e){e.O(0,[9993,9774,2888,179],function(){return e(e.s=66684)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.