add_filter in wp plugin for custom post type


/ Published in: PHP
Save to your folder(s)

add_filter in plugin


Copy this code and paste it in your HTML
  1. public function run() {
  2.  
  3. foreach ( $this->filters as $hook ) {
  4. add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
  5. }
  6.  
  7. foreach ( $this->actions as $hook ) {
  8. add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
  9. }
  10.  
  11. /* Adding custom filter to change the Post Title palceholder text */
  12. function change_title_text( $title ) {
  13. $screen = get_current_screen();
  14. if ( 'child_sponsorship' == $screen->post_type ) {
  15. $title = 'Enter child name';
  16. }
  17. return $title;
  18. }
  19.  
  20. add_filter( 'enter_title_here', 'change_title_text' );
  21.  
  22.  
  23. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.