retesere20

Untitled

Jan 14th, 2018
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('register_post_type_args', array($this, 'method__modify_post_args'), 150, 2);
  2.  
  3. // method 2 (seems useless): child posts go to 404
  4. function method__modify_post_args($args,$p){
  5.  
  6. // example of registered output: $args https://pastebin.com/raw/pNA5vjNn
  7. if($p=='post'){
  8. $args['hierarchical']=true;
  9. // 'query_var' doesnt change anything
  10. // $args['rewrite']=true; // causes fatal error, because rewriting yet not initialized
  11. $args['labels']["name"]="Posts";
  12. $args['labels']["singular_name"]="Post";
  13. //$args['label']="Posts"; //doesnt change anything.. more labels in: wp-includes/post.php
  14. }
  15. // example of set_args func: https://pastebin.com/raw/VxZAJcqC
  16. return $args;
  17. }
RAW Paste Data