How to pass extra variable in wordpress admin post.php

i want to pass variable post edit url in edit.php
by default this is the link

http://wordpresssite.com/wp-admin/post.php?post=62&action=edit"

I want to add one or more variable in this url like

Read More
http://wordpresssite.com/wp-admin/post.php?post=62&action=edit&post_type=newproduct"

when the user click anyone of the post listed in all post it will redirect to post.php with new variables how can we do this?

Related posts

Leave a Reply

1 comment

  1. Following code will do the job:

    add_action('add_meta_boxes_post', 'add_extra_param');
    
    function add_extra_param( $post ){
    
     if(!isset($_REQUEST['new_param'])){
           ?>
           <script type="text/javascript">
                window.location = window.location.href + '&new_param=new_value';
           </script>
           <?php
     }
    
    }
    

    If you want to specify a post type before appending a parameter, you can use ‘add_meta_boxes’ hook. See, here the details of both the hooks i.e. ‘add_meta_boxes_post’ and ‘add_meta_boxes’: http://codex.wordpress.org/Plugin_API/Action_Reference/add_meta_boxes

    Though you don’t have to deal with meta boxes here, these hooks run when you access any post in the admin area.