I found a WordPress hook called “edit_form_after_title
” to add a text box after the title.
How can I use this hook to display the excerpt after the title while creating a new post?
I found a WordPress hook called “edit_form_after_title
” to add a text box after the title.
How can I use this hook to display the excerpt after the title while creating a new post?
Comments are closed.
It’s simple, just unregister
postexcerpt
box first then add another one on the top.Here is my code
I adapted from here: https://wordpress.stackexchange.com/a/158485/373
In this way, you are able to add exactly an excerpt box as you like.
But it is important to eliminate the original box. If not, you will not be able to save the excerpt in the new box.
This answer is similar to the one @OzzyCzech posted, but it’s more universal and it adds a header to the excerpt box. One downside to this method is that you can’t hide the excerpt box via Screen Options… in that case you’d need to use the answer by @lea-cohen.
If you want to move the postexcerpt for a WooCommerce PRODUCT (short description), you have to use a different hook to get rid of the original postexcerpt. (If you don’t, you can’t really edit it from your new box at the top because it still exists at the bottom.)
I spent hours on this to remove the WooCommerce short description metabox (and then add it up above the main content editor). I could ONLY get rid of the postexcerpt by using the add_meta_boxes hook. admin_menu and adminhead ran too early. So I removed everything else at the same time.
The rest worked like a charm to put the new short description up above the long description. Thank you!
Answers outdated for guttenberg.
You must first remove post excerpt support and then add your custom excerpt meta