Hook Code Overview Use this tool to create custom Hooks with add_filter() and add_action() functions. Usage Fill in the user-friendly form. Click the “Update Code” button. Copy the code to your project. Or save it as a snippet and share with the community. Examples If you are still learning how to use this tool, check out the following examples: Document <title> separator Conditional login redirect Remove admin menus Set custom excerpt length Hook Type Filter Action Actions of filters. Hook Name Which filter/action you want to hook into?Hook Information Callback Function The name of the function to be called. Priority The order in which the function associated with this particular hook is executed. Accepted Arguments The # of arguments the function accepts. Arguments List The names of the arguments listed in the callback function. Code // Change separator for singular blog post if( is_singular( 'post' ) ) { $sep = '|'; } return $sep; Custom code in the function. Update Code Save Snippet
function custom_document_title_separator( $sep ) { // Change separator for singular blog post if( is_singular( 'post' ) ) { $sep = '|'; } return $sep; } add_filter( 'document_title_separator', 'custom_document_title_separator', 10, 1 );