0

Actually I'm trying to hide update button from edit view.bellow code is working for me.But the thing is when i update other than this particular post type(book)it will not redirect to same edit view.it's redirect to empty page

function hide_edit_book_update(){ ?>
  <style type="text/css">
   .post-type-book #publishing-action {display:none;}
  </style><?php
}
add_action( 'admin_enqueue_scripts', 'hide_edit_book_update' );
  • Have you added any other code? This could would not cause your issue. Something else is affecting the update of other post types. It's not this. – Jacob Peattie Oct 16 at 7:24
  • @JacobPeattie yes it's ok now.But now can't publish new custom post(book).i think publish and update button are same. display value only diffrent <div id="publishing-action"> <span class="spinner"></span> <input name="original_publish" type="hidden" id="original_publish" value="Update"> <input name="save" type="submit" class="button button-primary button-large" id="publish" value="Update"> </div> – Musni Oct 16 at 7:48
  • need to know any identifier to differentiate this both(add newpost and edit post) – Musni Oct 16 at 8:10
  • They are the same button. What’s the ultimate goal here? – Jacob Peattie Oct 16 at 8:25
0

finally I found the answer.

 function hide_edit_book_update(){ ?>
  <style type="text/css">
   .post-php.post-type-book #publishing-action {display:none;}
  </style><?php
}
add_action( 'admin_enqueue_scripts', 'hide_edit_book_update' );

add new post and edit post we can differentiate from post-php and php-new-php css class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.