register_activation_hook in wordpress usage

register_activation_hook -Plugin activation function in wordpress will be run plugin is activated...

how can add menu and sub menu on wordpress admin area plugin creation


function travel_admin_menu() {
 add_menu_page("Test", "Test",3,

 add_submenu_page(__FILE__,'Site list','Site list','3','list-site','pro_admin_list_site');

how can get template directory on wordpress

You can get current template diretory
<?php get_template_directory(); ?>

wordpress admin how can add javascript to header

function my_custom_js() {
    echo '<script type="text/javascript" src="myjsfile.js"></script>';
// Add hook for admin <head></head>
add_action('admin_head', 'my_custom_js');
// Add hook for front-end <head></head>
add_action('wp_head', 'my_custom_js');

how can add script function in wordpress

how can add script  function in wordpress

add_action('template_redirect', 'add_my_script');

function add_my_script() {
wp_enqueue_script('my-script', plugins_url('my-script.js', __FILE__), array('jquery'), '1.0', true);

how to create redirect page in wordpress

how to create redirect page in wordpress

wp_redirect( $location, $status );


Ex:<?php wp_redirect( home_url() ); exit; ?>