Wordpress plugin weasis4/30/2023 This is a problem because PHP does not allow multiple functions with the same name. It is possible that someone has created a plugin with a function named the same as one in your plugin. See the next section, Avoiding Function Name Collisions for more information. NOTE: Keep in mind that other plugins or the WordPress core may already be using the function name you have thought of. with print) will appear in the page source at the location where the action was invoked. Besides the one parameter, you can also access the global variables of WordPress, and call other WordPress functions (or functions in your plugin file).Īny text output by the function (e.g. Some actions take more than one parameter - check the documentation for the action (if available) or the WordPress source code for more information. For example, if you want your friends to get an email message whenever you create a new post, you might define the following function:įor most actions, your function should accept a single parameter (usually the post or comment ID, depending on the action). The first step in creating an action in your plugin is to create a PHP function with the action functionality of your plugin and put it in your plugin file (your plugin file must go into the wp-content/plugins directory).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |