PageSourceSearch

https://fulltextsearch.org/docs/_next/static/chunks/pages/en/exten…/wpfts_admin_menu-d899fd83507e8d59.js

js fulltextsearch.org collected 2026-09-25 21:08:12 UTC 9,543 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9792],{8e3:function(i,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/en/extending/filters/wpfts_admin_menu",function(){return n(69315)}])},69315:function(i,s,n){"use strict";n.r(s),n.d(s,{useTOC:function(){return useTOC}});var e=n(85893),h=n(37812),t=n(80390),l=n(38925);function useTOC(i){return[{value:"When to Use",id:"when-to-use",depth:2},{value:"Arguments",id:"arguments",depth:2},{value:"Return Value",id:"return-value",depth:2},{value:"Example",id:"example",depth:2},{value:"Important Notes",id:"important-notes",depth:2}]}s.default=(0,h.c)(function(i){let{toc:s=useTOC(i)}=i,n={code:"code",h1:"h1",h2:"h2",li:"li",p:"p",pre:"pre",span:"span",strong:"strong",ul:"ul",...(0,l.a)(),...i.components};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.h1,{children:"wpfts_admin_menu (Action)"}),"\n",(0,e.jsxs)(n.p,{children:["The ",(0,e.jsx)(n.code,{children:"wpfts_admin_menu"})," hook is called by the ",(0,e.jsx)(n.code,{children:"WP Fast Total Search"})," plugin when building its admin menu. This allows developers to add their own menu items to the WPFTS settings section, providing convenient access to their extension’s settings."]}),"\n",(0,e.jsx)(n.h2,{id:s[0].id,children:s[0].value}),"\n",(0,e.jsx)(n.p,{children:"This hook is useful if your extension has settings that need to be modified through the admin interface. By adding your own menu item, you make your extension’s settings easily accessible to users."}),"\n",(0,e.jsx)(n.h2,{id:s[1].id,children:s[1].value}),"\n",(0,e.jsxs)(n.p,{children:["The ",(0,e.jsx)(n.code,{children:"wpfts_admin_menu"})," hook ",(0,e.jsx)(n.strong,{children:"does not accept any arguments"}),"."]}),"\n",(0,e.jsx)(n.h2,{id:s[2].id,children:s[2].value}),"\n",(0,e.jsxs)(n.p,{children:["The ",(0,e.jsx)(n.code,{children:"wpfts_admin_menu"})," hook ",(0,e.jsx)(n.strong,{children:"should not return any value"}),"."]}),"\n",(0,e.jsx)(n.h2,{id:s[3].id,children:s[3].value}),"\n",(0,e.jsx)(n.pre,{tabIndex:"0","data-language":"php","data-word-wrap":"","data-copy":"",children:(0,e.jsxs)(n.code,{children:[(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"/**"})}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:' * Adds a "My Addon Settings" menu item to the WPFTS settings section.'})}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:" */"})}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"add_action"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"'wpfts_admin_menu'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"'my_addon_admin_menu'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:");"})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"function"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" my_addon_admin_menu"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"() {"})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"	add_submenu_page"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"		'wpfts-options'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// Parent menu item (WPFTS settings)."})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"		'My Addon Settings'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// Page title."})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"		'My Addon'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// Menu title."})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"		'manage_options'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// Capability (administrators only)."})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"		'my-addon-settings'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"// Menu slug."})]}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"		'my_addon_settings_page'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:" // Callback function."})]}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"	);"})}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"}"})}),"\n",(0,e.jsx)(n.span,{children:" "}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"/**"})}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"}
1,children:" * Displays the addon settings page."})}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:" */"})}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"function"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" my_addon_settings_page"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"() {"})]}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"    // Code to display the settings page."})}),"\n",(0,e.jsxs)(n.span,{children:[(0,e.jsx)(n.span,{style:{"--shiki-light":"#005CC5","--shiki-dark":"#79B8FF"},children:"    echo"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" '<h2>'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:" ."}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:" esc_html__"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"("}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"'My Addon Settings'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:", "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"'my-addon'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:") "}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"."}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" '</h2>'"}),(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#6A737D","--shiki-dark":"#6A737D"},children:"    // ... settings form ..."})}),"\n",(0,e.jsx)(n.span,{children:(0,e.jsx)(n.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:"}"})})]})}),"\n",(0,e.jsx)(n.h2,{id:s[4].id,children:s[4].value}),"\n",(0,e.jsxs)(n.ul,{children:["\n",(0,e.jsx)(n.li,{children:"The menu slug (my-addon-settings in the example) must be unique."}),"\n",(0,e.jsx)(n.li,{children:"The function displaying the settings page (my_addon_settings_page in the example) should handle saving settings and display the settings form."}),"\n",(0,e.jsx)(n.li,{children:"Make sure your code correctly handles nonce for protection against CSRF attacks."}),"\n"]}),"\n",(0,e.jsxs)(n.p,{children:["Using the ",(0,e.jsx)(n.code,{children:"wpfts_admin_menu"})," hook, you can integrate your extension’s settings into the WPFTS interface, making it more user-friendly."]})]})},"/en/extending/filters/wpfts_admin_menu",{filePath:"pages/en/extending/filters/wpfts_admin_menu.md",timestamp:1733329702e3,pageMap:t.v,frontMatter:{},title:"wpfts_admin_menu (Action)"},"undefined"==typeof RemoteContent?useTOC:RemoteContent.useTOC)}},function(i){i.O(0,[9993,9774,2888,179],function(){return i(i.s=8e3)}),_N_E=i.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.