{"id":5589,"date":"2021-08-10T07:50:00","date_gmt":"2021-08-10T07:50:00","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=5589"},"modified":"2023-10-18T06:37:10","modified_gmt":"2023-10-18T06:37:10","slug":"how-to-create-wordpress-plugin","status":"publish","type":"post","link":"\/ph\/tutorials\/how-to-create-wordpress-plugin","title":{"rendered":"How to Create a WordPress Plugin Step-by-Step"},"content":{"rendered":"<p>WordPress has a massive collection of plugins available that introduce custom functionality. What&rsquo;s more, plugins can add new features to your WordPress website without having to change the core code.<\/p><p>While there are tons of free and premium plugins to choose from, there may be occasions when you need specific WordPress functions that aren&rsquo;t available. For that, you may need to build your own WordPress plugin.<\/p><p>In this WordPress plugin tutorial, you&rsquo;ll learn the steps to create a WordPress plugin. We will also go over the best coding and plugin creation practices and standards.<\/p><p>Additionally, this article will cover the differences between a plugin and a theme and how they work on the WordPress platform.<\/p><p>\n\n\n\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-you-ll-need-to-make-a-wordpress-plugin\">What You&rsquo;ll Need to Make a WordPress Plugin<\/h2><p>Here is what you will need to create a WordPress plugin:<\/p><ul class=\"wp-block-list\">\n<li>A text editor<\/li>\n\n\n\n<li><a href=\"\/ph\/tutorials\/ftp\/filezilla-ftp-configuration\">FTP access<\/a> to your hosting account<\/li>\n\n\n\n<li>A working <a href=\"\/ph\/tutorials\/how-to-install-wordpress\">WordPress installation<\/a><\/li>\n<\/ul><p>You will need a text editor to write the plugin code. Some of the most popular <a href=\"\/ph\/tutorials\/best-html-editors\">HTML editors<\/a> include <a href=\"https:\/\/notepad-plus-plus.org\/\" target=\"_blank\" rel=\"noopener\">Notepad++<\/a> and <a href=\"https:\/\/atom.io\/\" target=\"_blank\" rel=\"noopener\">Atom<\/a>.<\/p><p>After installing the text editor, connect it to your FTP server for code modification. We have a guide on how to <a href=\"\/ph\/tutorials\/how-to-connect-to-ftp-with-notepad\/\">connect to FTP with Notepad++<\/a> if you need assistance.<\/p><p>Next, configure an FTP client to upload the plugin file to your website. We recommend using the FileZilla FTP application as it is straightforward to set up.<\/p><p>Lastly, make sure you have a working and up-to-date WordPress installation. There are several ways to <a href=\"\/ph\/tutorials\/how-to-update-wordpress\">update the WordPress<\/a> core files if you have disabled automatic updates. <a href=\"\/ph\/tutorials\/backup-wordpress\">Back up your WordPress files<\/a> before updating the site to avoid data loss.<\/p><p>Alternatively, consider <a href=\"\/ph\/tutorials\/install-wordpress-locally\">installing WordPress locally<\/a>. This method doesn&rsquo;t require a live website with a domain name and a hosting plan, so you can test your plugin without visitors seeing it right away.<\/p><p>Having a basic knowledge of PHP will benefit your plugin development process. You&rsquo;ll need to write a custom function and call existing WordPress core functions. At the very least, you should be familiar with PHP naming conventions and file structuring.<\/p><h2 class=\"wp-block-heading\" id=\"h-wordpress-plugins-vs-wordpress-themes\">WordPress Plugins vs WordPress Themes<\/h2><p>WordPress site functionality can be changed through plugins and themes.<\/p><p>WordPress themes have a <strong>functions.php<\/strong> file stored in the <strong>\/wp-includes\/ <\/strong>folder, which lets you add custom code for new functions.<\/p><p>While this method works for minor alterations, it is impractical for implementing major changes that affect the entire website.<\/p><p>That&rsquo;s because the functionality stored in the <strong>functions.php<\/strong> file depends on whether the theme is active or not. Disabling the WordPress theme will revert the changes made in the said file and trigger an error when the site calls for the missing functions.<\/p><p>Unless you&rsquo;re using a child theme, updating the theme will also overwrite the <strong>functions.php <\/strong>file, forcing you to manually restore the custom WordPress code.<\/p><p>That&rsquo;s why building a custom plugin is helpful. Doing so facilitates the modification of default WordPress behavior to fit your needs.<\/p><p>You can add WordPress plugins to any WordPress installation. Features introduced by the plugin will remain functional even if you switch themes. Plus, updates won&rsquo;t overwrite existing functions, saving you time and effort.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-are-wordpress-hooks\">What are WordPress Hooks?<\/h2><p>WordPress plugins interact with the core code using hooks. There are two different types of <a href=\"\/ph\/tutorials\/what-are-wordpress-hooks\/\">WordPress hooks<\/a>:<\/p><ul class=\"wp-block-list\">\n<li><strong>Action hooks<\/strong> &#8210; add or remove functions.<\/li>\n\n\n\n<li><strong>Filter hooks<\/strong> &#8210; modify data produced by functions.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-actions-and-action-hooks\">Actions and Action Hooks<\/h3><p>An action is a PHP function called through a specific action hook when a user visits a WordPress web page. Web developers can add their own functions to the list of actions or remove pre-existing ones by adding the <strong>wp_head() <\/strong>action hook script before the closing tag (<strong>&lt;\/head&gt;<\/strong>) of any page.<\/p><p>Action hooks are contextual, which means that not all WordPress pages call for them. The<a href=\"https:\/\/codex.wordpress.org\/Plugin_API\/Action_Reference\" target=\"_blank\" rel=\"noopener\"> WordPress Plugin Action Reference<\/a> page provides a complete list of action hooks and the contexts within which they are called.<\/p><p><strong>Adding Functions to an Action Hook Using add_action()<\/strong><\/p><p>Adding functions to an action hook in a plugin file requires calling the <strong>add_action()<\/strong> function with at least two parameters.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Hook to the 'init' action, which is called after WordPress is finished loading the core code\nadd_action( 'init', 'add_Cookie' );\n\/\/ Set a cookie with the current time of day\nfunction add_Cookie() {\n setcookie(\"last_visit_time\", date(\"r\"), time()+60*60*24*30, \"\/\");\n}<\/pre><p>The third optional parameter states the <strong>priority <\/strong>of the said function. The default priority is 10, putting the custom function after any of the built-in ones.<\/p><p>The first parameter is the name of the<strong> action hook <\/strong>you want to attach the callback to, while the second parameter contains the name of the<strong> function <\/strong>that you want to run.<\/p><p>The fourth parameter, which is also optional, contains the <strong>number of arguments<\/strong> or parameters the custom function can take. The default value is 1.<\/p><p><strong>Example of Plugin Code to Display Text After the Footer of Every Page<\/strong><\/p><p>This example plugin calls the<strong> wp_footer()<\/strong> action hook before the closing <strong>&lt;\/body&gt;<\/strong> tag of every page, and adds a new function named <strong>mfp_Add_Text()<\/strong>. Since it&rsquo;s part of a plugin, the function will work even after switching themes.<\/p><p>Save this example as a PHP file and upload it to the <strong>plugins<\/strong> folder.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/*\nPlugin Name: Add Text To Footer\n*\/\n\/\/ Hook the 'wp_footer' action hook, add the function named 'mfp_Add_Text' to it\nadd_action(\"wp_footer\", \"mfp_Add_Text\");\n \n\/\/ Define 'mfp_Add_Text'\nfunction mfp_Add_Text()\n{\n  echo \"&lt;p style='color: black;'&gt;After the footer is loaded, my text is added!&lt;\/p&gt;\";\n}<\/pre><p>The following screenshot shows the plugin in action after activating it via the WordPress admin panel:<\/p><figure class=\"wp-block-image size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/plugin-in-action.png\"><img decoding=\"async\" width=\"800\" height=\"107\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/plugin-in-action.png\" alt=\"A screenshot from the WordpRess admin panel confirming that the plugin is in action\" class=\"wp-image-34407\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/plugin-in-action.png 800w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/plugin-in-action-300x40.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/plugin-in-action-150x20.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/plugin-in-action-768x103.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/figure><p>\n\n\n<div><p class=\"important\"><b>Important!<\/b> PHP evaluates the entire script before executing it. Writing add_action() calls at the top of the file in their execution order and then defining your functions in the same order below will make the file easier to read.<\/p><\/div>\n\n\n\n<\/p><p><strong>Removing Functions From an Action Hook Using remove_action()<\/strong><\/p><p>To remove an action from an action hook, write a new function <strong>remove_action()<\/strong> and then call the function you have written using <strong>add_action()<\/strong>.<\/p><p>The <strong>remove_action()<\/strong> function should also contain at least two parameters.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Hook the 'init' action, which is called after WordPress is finished loading the core code, add the function 'remove_My_Meta_Tags'\nadd_action( 'init', 'remove_My_Meta_Tags' );\n\/\/ Remove the 'add_My_Meta_Tags' function from the wp_head action hook\nfunction remove_My_Meta_Tags()\n{\n  remove_action( 'wp_head', 'add_My_Meta_Tags');\n}<\/pre><p>The first parameter is the name of the<strong> action hook <\/strong>the function is attached to, while the second parameter contains the name of the<strong> function <\/strong>that you want to remove.<\/p><p>The third optional parameter states the <strong>priority <\/strong>of the original function. It must be identical to the priority that was originally defined when adding the action to the action hook. If you didn&rsquo;t define a priority in the custom function, don&rsquo;t include this parameter.<\/p><p>In the next example, we&rsquo;ll prevent the extra footer text from appearing on Monday posts.<\/p><p>One way of doing this is by using the PHP <strong>date()<\/strong> function to get the current day, followed by conditional tags to check if it is Monday. After parsing the information, the page will execute the <strong>remove_action() <\/strong>function in every post published on Mondays.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n \/\/ Hook the 'wp_footer' action, run the function named 'mfp_Add_Text()'\nadd_action(\"wp_footer\", \"mfp_Add_Text\");\n\/\/ Hook the 'wp_head' action, run the function named 'mfp_Remove_Text()'\nadd_action(\"wp_head\", \"mfp_Remove_Text\");\n\/\/ Define the function named 'mfp_Add_Text('), which just echoes simple text\nfunction mfp_Add_Text()\n{\n  echo \"&lt;p style='color: #FFF;'&gt;After the footer is loaded, my text is added!&lt;\/p&gt;\";\n}\n\/\/ Define the function named 'mfp_Remove_Text()' to remove our previous function from the 'wp_footer' action\nfunction mfp_Remove_Text()\n{\n  if (date(\"l\") === \"Monday\") {\n    \/\/ Target the 'wp_footer' action, remove the 'mfp_Add_Text' function from it\n    remove_action(\"wp_footer\", \"mfp_Add_Text\");\n  }\n}<\/pre><h3 class=\"wp-block-heading\" id=\"h-filters-and-filter-hooks\">Filters and Filter Hooks<\/h3><p>A filter is a PHP function called by a specific filter hook that modifies data returned by existing functions. Like action hooks, filter hooks are also contextual.<\/p><p>The complete list of filter hooks and contexts they are called in are available on the <a href=\"https:\/\/codex.wordpress.org\/Plugin_API\/Filter_Reference\" target=\"_blank\" rel=\"noopener\">WordPress Plugin Filter Reference<\/a> page.<\/p><p><strong>Adding Filters Using add_filter()<\/strong><\/p><p>Adding a filter function to a filter hook within a plugin file requires calling the <strong>add_filter()<\/strong> function with at least two parameters.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Hook the 'the_content' filter hook (content of any post), run the function named 'mfp_Fix_Text_Spacing'\nadd_filter(\"the_content\", \"mfp_Fix_Text_Spacing\");\n\/\/ Automatically correct double spaces from any post\nfunction mfp_Fix_Text_Spacing($the_Post)\n{\n $the_New_Post = str_replace(\"  \", \" \", $the_Post);\n return $the_New_Post;\n}<\/pre><p>The first parameter is the name of the<strong> filter hook <\/strong>you want to add the callback to, while the second parameter contains the name of the <strong>function <\/strong>you want to run when the filter is applied.<\/p><p>The third optional parameter states the <strong>priority <\/strong>of the said function. The default priority is 10, putting the custom function after any default ones.<\/p><p>The fourth optional parameter contains the <strong>number of arguments<\/strong> or parameters the custom filter function can take. The default value is 1.<\/p><p><strong>Example Plugin to Alter a Post Excerpt<\/strong><\/p><p>WordPress has a function that retrieves post excerpts named <strong>get_the_excerpt()<\/strong>. It is also a filter hook. Adding this filter after retrieving the excerpt will alter the text before the WordPress site displays it.<\/p><p>The following example plugin defines a filter function that takes the excerpt as its only input parameter, adds some text before it, and returns the new value every time the script calls the <strong>get_the_excerpt()<\/strong> function.<\/p><p>As the return value of the <strong>get_the_excerpt() <\/strong>function is the actual excerpt text, the plugin will automatically input the new value as the function&rsquo;s parameter <strong>$old_Excerpt <\/strong>when called using<strong> add_filter()<\/strong>.<strong> <\/strong>The function the plugin defines <strong>must return the new value<\/strong>.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/*\nPlugin Name: Add Excerpt \n*\/\n\/\/ Hook the get_the_excerpt filter hook, run the function named mfp_Add_Text_To_Excerpt\nadd_filter(\"get_the_excerpt\", \"mfp_Add_Text_To_Excerpt\");\n\/\/ Take the excerpt, add some text before it, and return the new excerpt\nfunction mfp_Add_Text_To_Excerpt($old_Excerpt)\n{\n  $new_Excerpt = \"&lt;b&gt;Excerpt: &lt;\/b&gt;\" . $old_Excerpt;\n  return $new_Excerpt;\n}<\/pre><p><strong>Removing Filters Using remove_filter()<\/strong><\/p><p>Removing a filter is much simpler than removing an action as WordPress lets you call the <strong>remove_filter() <\/strong>function without defining a new one.<\/p><p>In the following example, we&rsquo;ll remove the additional excerpt text if the current day is Thursday. We&rsquo;ll use the <strong>remove_filter()<\/strong> function with at least two parameters.<\/p><p>The first one should contain the filter hook the function is attached to. The second parameter should be the name of the filter you want to remove. Add a priority parameter if you defined it when creating the function.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Hook the get_the_excerpt filter hook, run the function named mfp_Add_Text_To_Excerpt\nadd_filter(\"get_the_excerpt\", \"mfp_Add_Text_To_Excerpt\");\n\/\/ If today is a Thursday, remove the filter from the_excerpt()\nif (date(\"l\") === \"Thursday\") {\n  remove_filter(\"get_the_excerpt\", \"mfp_Add_Text_To_Excerpt\");\n}\n\/\/ Take the excerpt, add some text before it, and return the new excerpt\nfunction mfp_Add_Text_To_Excerpt($old_Excerpt)\n{\n  $new_Excerpt = \"&lt;b&gt;Excerpt: &lt;\/b&gt;\" . $old_Excerpt;\n  return $new_Excerpt;\n}<\/pre><p>Now that you have a basic understanding of hooks and filters, we&rsquo;ll create a simple WordPress plugin that will add a new page with a link on the admin control panel.<\/p><p>\n\n\n<div><p class=\"important\"><b>Important!<\/b> Using a WordPress staging site to test new plugins will help you avoid errors that may cause downtime. There are two ways to build a staging environment &#8210; manually or by using a plugin like WP Staging. Alternatively, install WordPress locally on your computer.<\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-step-1-storing-the-plugin\">Step 1 &ndash; Storing the Plugin<\/h2><p>The first step to creating a new plugin is to make a folder for its files. The folder&rsquo;s name should be unique and descriptive. Check the other plugin folders&rsquo; names within <strong>\/wp-content\/plugins\/ <\/strong>to make sure that the new name isn&rsquo;t in use already.<\/p><p>Use an FTP client to connect to your hosting account to facilitate the file upload process. Navigate to <strong>wp-content <\/strong>-&gt; <strong>plugins<\/strong> from the main WordPress directory. Then, create a new folder named <strong>my-new-plugin <\/strong>in the <strong>plugins <\/strong>folder.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/FTP-client.png\"><img decoding=\"async\" width=\"1024\" height=\"288\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/FTP-client-1024x288.png\" alt=\"A screenshot from the FTP client showing where to create the my-first-plugin folder\" class=\"wp-image-34408\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-1024x288.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-300x84.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-150x42.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-768x216.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Practicing file management during WordPress development will make the process much easier in the long run. Divide the files into subfolders based on their functionality.<\/p><p>For example, save the CSS, PHP, and JavaScript files in separate folders. As you develop your custom WordPress plugin, it&rsquo;ll be easier to locate specific files when everything has a dedicated directory.<\/p><h2 class=\"wp-block-heading\" id=\"h-step-2-creating-the-first-file\">Step 2 &ndash; Creating the First File<\/h2><p>The main plugin file will contain the information WordPress requires to display your plugin in the plugin list where you&rsquo;ll be able to activate it.<\/p><p>Create a new PHP file called <strong>my-first-plugin.php <\/strong>in the folder you made earlier. This main plugin file will contain header comments with additional information for WordPress to read or display.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/FTP-client-view.png\"><img decoding=\"async\" width=\"1024\" height=\"350\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/FTP-client-view-1024x350.png\" alt=\"A screenshot from the FTP client showing how to view or edit your PHP file\" class=\"wp-image-34409\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-view-1024x350.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-view-300x103.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-view-150x51.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-view-768x263.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FTP-client-view.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Then, right-click the file and select <strong>View\/Edit<\/strong> to add the following code using an HTML editor:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/*\nPlugin Name: My First Plugin\nDescription: This is my first plugin! It makes a new admin menu link!\nAuthor: Your Name\n*\/<\/pre><p>You can refer to this <a href=\"https:\/\/www.php.net\/basic-syntax.instruction-separation\" target=\"_blank\" rel=\"noopener\">PHP manual<\/a> to understand why the closing tag <strong>?&gt;<\/strong> isn&rsquo;t necessary here.<\/p><p>Save the file. Then, navigate to the <strong>Plugins <\/strong>section of your WordPress dashboard. If WordPress has read the new file correctly, you&rsquo;ll see <strong>My First Plugin<\/strong> on the list:<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/WordPress-dashboard-plugin.png\"><img decoding=\"async\" width=\"1024\" height=\"476\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/WordPress-dashboard-plugin-1024x476.png\" alt=\"A screenshot from the WordPress dahboard showing where to find your plugin\" class=\"wp-image-34410\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-plugin-1024x476.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-plugin-300x139.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-plugin-150x70.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-plugin-768x357.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-plugin.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-step-3-writing-the-plugin-functions\">Step 3 &ndash; Writing the Plugin Functions<\/h2><p>Before we begin writing the functions for the plugin, it is highly recommended to give all files, functions, and variables a unique prefix in their name to avoid any conflicts with other plugins. In our example, we&rsquo;ll be using the prefix <strong>mfp<\/strong>, which is short for <strong>My First Plugin<\/strong>.<\/p><p>Create a new folder named <strong>Includes <\/strong>in the plugin&rsquo;s main directory. We&rsquo;ll use it to store supporting files used by the main file. In this folder, create a PHP file and name it <strong>mfp-functions.php<\/strong>. Give it the opening <strong>&lt;?php<\/strong> tag on the first line.<\/p><p>This new file will contain all of your plugin&rsquo;s functions.<\/p><p>We&rsquo;ll have to include <strong>mfp-functions.php<\/strong> in the main plugin file to allow the other plugin files to use the functions it defines. Use <strong>require_once<\/strong> to ensure the plugin only works if the functions file is present.<\/p><p>Edit <strong>my-first-plugin.php <\/strong>as shown below. Then, save it and upload the file once again, overwriting the previous version when asked.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/*\nPlugin Name: My First Plugin\nDescription: This is my first plugin! It makes a new admin menu link!\nAuthor: Your Name\n*\/\n\/\/ Include mfp-functions.php, use require_once to stop the script if mfp-functions.php is not found\nrequire_once plugin_dir_path(__FILE__) . 'includes\/mfp-functions.php';<\/pre><p>The WordPress function <strong>plugin_dir_path(__FILE__)<\/strong> lets you include files from your plugin folder, giving the full path to the directory that stores the new plugin.<\/p><p>Now, return to the <strong>mfp-functions.php<\/strong> file in the <strong>Includes<\/strong> directory. As our plugin will add a new top-level link to the navigation menu of the admin control panel, we&rsquo;ll use a custom function named <strong>mfp_Add_My_Admin_Link()<\/strong>. Add the code block below to the <strong>mfp-functions.php<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/*\n * Add my new menu to the Admin Control Panel\n *\/\n\/\/ Hook the 'admin_menu' action hook, run the function named 'mfp_Add_My_Admin_Link()'\nadd_action( 'admin_menu', 'mfp_Add_My_Admin_Link' );\n\/\/ Add a new top level menu link to the ACP\nfunction mfp_Add_My_Admin_Link()\n{\n      add_menu_page(\n        'My First Page', \/\/ Title of the page\n        'My First Plugin', \/\/ Text to show on the menu link\n        'manage_options', \/\/ Capability requirement to see the link\n        'includes\/mfp-first-acp-page.php' \/\/ The 'slug' - file to display when clicking the link\n    );\n}<\/pre><p>\n\n\n<div><p class=\"important\"><b>Important!<\/b> Group similar functions together and add a description above each of them using a multi-line comment. Doing so will make future plugin updates and debugging easier.<\/p><\/div>\n\n\n\n<\/p><p><strong>mfp_Add_My_Admin_Link()<\/strong> uses the built-in WordPress function <strong>add_menu_page()<\/strong> with at least four parameters in the following order:<\/p><ul class=\"wp-block-list\">\n<li><strong>Page title<\/strong> &#8210; the page name displayed on the browser tab.<\/li>\n\n\n\n<li><strong>Menu title<\/strong> &#8210; the text used for the menu item. In our example, it is the plugin&rsquo;s name.<\/li>\n\n\n\n<li><strong>Capability <\/strong>&#8210; user capability requirement to view the plugin menu. Here, only users with the <strong>manage_options<\/strong> capability can access the linked page.<\/li>\n\n\n\n<li><strong>Menu slug<\/strong> &#8210; the file to use to display the actual page. We&rsquo;ll create the linked-to <strong>mfp-first-acp-page.php <\/strong>file in the <strong>Includes <\/strong>folder in the next section.<\/li>\n\n\n\n<li><strong>Function (optional)<\/strong> &#8210; the function that outputs the page content.<\/li>\n<\/ul><p>Attaching the custom function using <strong>add_action()<\/strong> allows the plugin to call the action hook under certain circumstances. Adding <strong>admin_menu <\/strong>as the first parameter will call the function when a user accesses the admin menu. Meanwhile, <strong>mfp_Add_My_Admin_Link<\/strong> is the function that will be run as it is specified as the second parameter.<\/p><p>Finally, upload the <strong>mfp-functions.php<\/strong> plugin file to the <strong>Includes<\/strong> folder.<\/p><h2 class=\"wp-block-heading\" id=\"h-step-4-creating-the-plugin-admin-page\">Step 4 &ndash; Creating the Plugin Admin Page<\/h2><p>After defining the plugin&rsquo;s functions, it&rsquo;s time to build the page that the menu button will take us to. Create a new PHP file named <strong>mfp-first-acp-page.php <\/strong>in the <strong>Includes <\/strong>subfolder and add the following code to it:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;div class=\"wrap\"&gt;\n  &lt;h1&gt;Hello!&lt;\/h1&gt;\n  &lt;p&gt;This is my plugin's first page&lt;\/p&gt;\n&lt;\/div&gt;\n<\/pre><p>When creating admin pages, WordPress recommends enclosing your own HTML with a <strong>&lt;div&gt; <\/strong>tag and giving it a <strong>&ldquo;wrap&rdquo;<\/strong> class to ensure that all your content appears in the correct place. Doing so also helps reduce clutter in the code.<\/p><p>Finally, navigate to the <strong>Plugins<\/strong> section on your WordPress dashboard and activate the new plugin. If the process is successful, the admin panel link of your very first plugin will appear at the bottom of the navigation menu.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/WordPress-dashboard-1.png\"><img decoding=\"async\" width=\"1024\" height=\"404\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/WordPress-dashboard-1-1024x404.png\" alt=\"A screenshot from the WordPress dashboard showing your plugin at the bottom of the the navigation menu\" class=\"wp-image-34411\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-1-1024x404.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-1-300x118.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-1-150x59.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-1-768x303.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-dashboard-1.png 1349w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Congratulations &ndash; you have successfully created your first WordPress plugin.<\/p><p>If you built the plugin on a staging site, you&rsquo;ll need to <a href=\"\/ph\/tutorials\/wordpress\/how-to-install-wordpress-plugins\">install the plugin<\/a> on the live site. The following steps will show you how to do it:<\/p><ol class=\"wp-block-list\">\n<li>In FileZilla, right-click the <strong>my-new-plugin<\/strong> folder and select <strong>Download<\/strong>. Then, compress the files into a ZIP<strong> <\/strong>archive.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/FileZilla-download.png\"><img decoding=\"async\" width=\"1024\" height=\"315\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/FileZilla-download-1024x315.png\" alt=\"A screenshot from FileZilla showing how to download your plugin\" class=\"wp-image-34412\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FileZilla-download-1024x315.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FileZilla-download-300x92.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FileZilla-download-150x46.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FileZilla-download-768x236.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/FileZilla-download.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol class=\"wp-block-list\" start=\"2\">\n<li>Navigate to the <strong>Plugins <\/strong>menu from your WordPress dashboard. Then, click <strong>Add New<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Upload Plugin<\/strong> and select the ZIP file of your plugin.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/WordPress-upload-plugin.png\"><img decoding=\"async\" width=\"1024\" height=\"295\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/08\/WordPress-upload-plugin-1024x295.png\" alt=\"A screenshot from the WordPress dashboard showing where to upload your plugin\" class=\"wp-image-34413\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-upload-plugin-1024x295.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-upload-plugin-300x86.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-upload-plugin-150x43.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-upload-plugin-768x221.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2021\/08\/WordPress-upload-plugin.png 1350w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol class=\"wp-block-list\" start=\"4\">\n<li>Select <strong>Install Now<\/strong> to start the installation process.<\/li>\n<\/ol><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Suggested Reading<\/h4>\n                    <p>Wondering what languages WordPress plugins are written in? Learn more in the following guides:<br>\n<a href=\"\/ph\/tutorials\/what-is-html\">What Is HTML<\/a><br>\n<a href=\"\/ph\/tutorials\/what-is-css\"> What Is CSS<\/a><br>\n<a href=\"\/ph\/tutorials\/what-is-javascript\">What Is JavaScript<\/a><br>\n<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-great-standards-and-practices-when-creating-custom-plugins\">Great Standards and Practices When Creating Custom Plugins<\/h2><p>As your site&rsquo;s needs continually evolve, you&rsquo;ll need to revisit the plugin&rsquo;s code to implement updates and security patches.<\/p><p>With this in mind, follow the best practices for plugin development right from the beginning. Doing so will make the entire process easier for you and any web developers you may work with in the future.<\/p><p>Additionally, refer to the <a href=\"\/ph\/tutorials\/best-wordpress-plugins\">best WordPress plugin<\/a> examples for inspiration. Look at their source code, how they organize their folders, and other practices to apply when building WordPress plugins. <\/p><p>Here are some of the best coding and plugin development practices to help the creation of your first WordPress plugin:<\/p><ul class=\"wp-block-list\">\n<li><strong>Develop and test WP plugins in a <a href=\"\/ph\/tutorials\/wordpress-staging-environment\">staging environment<\/a>. <\/strong>This way, there&rsquo;ll be no risk of breaking the site if a plugin has faulty code.<\/li>\n\n\n\n<li><strong>Build a logical folder structure.<\/strong> Create subfolders for each functionality and divide the code into separate files based on their purpose or language type to avoid clutter.<\/li>\n\n\n\n<li><strong>Name each file, folder, and element with caution.<\/strong> Use unique prefixes, so they don&rsquo;t clash with the file names of other plugins or the WordPress core.<\/li>\n\n\n\n<li><strong>Add comments to label each function.<\/strong> Doing so allows you and other developers to understand your code when updating or debugging it.<\/li>\n\n\n\n<li><strong>Create documentation<\/strong>. This practice is particularly beneficial if you create plugins with complex functionality for a large number of users.<\/li>\n\n\n\n<li><strong>Use version control software to track changes made in your code.<\/strong> Knowing who added what will help prevent clashes between updates and reduce the number of bugs.<\/li>\n\n\n\n<li><strong>Refer to the <\/strong><a href=\"https:\/\/make.wordpress.org\/core\/handbook\/best-practices\/coding-standards\/\" target=\"_blank\" rel=\"noopener\"><strong>WordPress Codex<\/strong><\/a><strong> for language-specific coding standards.<\/strong> Make sure to comply with them when collaborating on a project.<\/li>\n\n\n\n<li><strong>Activate <\/strong><a href=\"\/ph\/tutorials\/debug-wordpress\"><strong>WP_DEBUG<\/strong><\/a><strong> or use a debugging tool when developing plugins.<\/strong> Doing so will make locating bugs easier, speeding the overall plugin building process.<\/li>\n<\/ul><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner-1024x300.png\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-1024x300.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-768x225.png 768w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner-1536x450.png 1536w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2024\/06\/New-WP_in-text-banner.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Developing a custom plugin is a way to add functionality to a WordPress site that currently available plugins don&rsquo;t offer. It can be a simple plugin that implements minor alterations or a complex one that modifies the entire site.<\/p><p>To recap, here are the steps to create a WordPress plugin from scratch:<\/p><ol class=\"wp-block-list\">\n<li>Create a folder to store the plugin files.<\/li>\n\n\n\n<li>Create the main file for your plugin.<\/li>\n\n\n\n<li>Add code to multiple files for plugin functions.<\/li>\n\n\n\n<li>Build the plugin&rsquo;s admin page.<\/li>\n<\/ol><p>Like with any other skill, it takes time to get good at making WordPress plugins. With enough practice, you&rsquo;ll be able to create plugins and make them available for download on the WordPress plugin directory or even sell them on one of the marketplaces.<\/p><p>We hope this article has taught you how to make a WordPress plugin. If you have any questions or remarks, feel free to leave a comment.<\/p><h2 class=\"wp-block-heading\" id=\"h-create-a-wordpress-plugin-faq\">Create A WordPress Plugin FAQ<\/h2><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1669212294571\"><h3 class=\"schema-faq-question\">Can You Make Money Making WordPress Plugins?<\/h3> <p class=\"schema-faq-answer\">Yes, you can either sell plugins through your own website or on a plugin marketplace.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1669212367807\"><h3 class=\"schema-faq-question\">Who Can Build a WordPress Plugin?<\/h3> <p class=\"schema-faq-answer\">Anyone who knows how to code can create a WordPress plugin. You can use a theme to create a plugin, if you know basic PHP.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1669212370223\"><h3 class=\"schema-faq-question\">Are WordPress Plugins Written In PHP?<\/h3> <p class=\"schema-faq-answer\">WordPress plugins are often written in PHP, but you will also need to know some basic HTML and CSS to properly manage the plugin&rsquo;s output.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>WordPress has a massive collection of plugins available that introduce custom functionality. What&rsquo;s more, plugins can add new features to your WordPress website without having to change the core code. While there are tons of free and premium plugins to choose from, there may be occasions when you need specific WordPress functions that aren&rsquo;t available. [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ph\/tutorials\/how-to-create-wordpress-plugin\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":72,"featured_media":46272,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Create WordPress Plugin from Scratch - WP Plugin Development","rank_math_description":"Interested in WordPress plugins development? See our tutorial on how to create WordPress plugin. Complete WordPress plugin template inside.","rank_math_focus_keyword":"how to make a wordpress plugin, wordpress plugin tutorial","footnotes":""},"categories":[22638,22632],"tags":[],"class_list":["post-5589","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-advanced","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-create-wordpress-plugin","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/criar-plugin-wordpress","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/creer-un-plugin-wordpress","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/tutorial-wordpress-plugins-crear-plugin-wordpress","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/membuat-plugin-wordpress","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/wordpress-plugin-erstellen","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-create-wordpress-plugin","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-create-wordpress-plugin","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-create-wordpress-plugin","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/joomla-vs-wordpress-cms-utilizar-4","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/joomla-vs-wordpress-cms-utilizar-4","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/tutorial-wordpress-plugins-crear-plugin-wordpress","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/criar-plugin-wordpress","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-create-wordpress-plugin","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-create-wordpress-plugin","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-create-wordpress-plugin","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-create-wordpress-plugin","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/5589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/users\/72"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/comments?post=5589"}],"version-history":[{"count":89,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/5589\/revisions"}],"predecessor-version":[{"id":96092,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/5589\/revisions\/96092"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media\/46272"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media?parent=5589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/categories?post=5589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/tags?post=5589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}