by Bhumi // Dec 17,2012 // 5 comments
WordPress provide functionality of action hook with which you can create your own action hook too.you can create new action hooks by calling
do_action() function and just need to specify the name of the new hook as $tag parameter.Whereas
add_action() is used to hooks a function on to a specific action.
do_action( $tag, $arg );
$tag is the name of the action to be executed.
$arg is an optional arguments which are passed on to the functions hooked to the action.
add_action( $tag, $function_to_add, $priority, $accepted_args );
Here is add_action,same like do_action $tag is the name of the action to be executed.Next argument is the name of the function to add for an action.Third argument defines the priority of code and fourth argument is for number of argument in the function.
Here in an example, going to show how to create an action hook that customize the login functionality just before the user logged into dashboard.
First of,place below code into the
wp-login.php file after post request for a form.
Next is use the function, which we can put in the
functions.php of the theme to add an action for the login
$result = $wpdb->get_var("Your_qry");
wp_redirect( site_url('wp-login.php') );
In this quick article, we will see how to get last auto increment id from table in WordPress. Recently I was working on plugin development READ MORE
As i have explained yesterday in post POST AUTOSAVE INTERVAL IN WORDPRESS,When you add/edit the post or pages, wordpress automatically save your content in database READ MORE
While you write a post in WordPress from admin,WordPress autosave the post with in every interval using AJAX call as a revision.Default interval set by READ MORE
Posted on Mar 2,2012
Posted on Dec 1,2011
Posted on Nov 26,2011
Posted on Jan 18,2013
Posted on Dec 12,2011
Be a Contributor at CreativeDev.Write an article or tutorial to the community and share some of your knowledge!