1

How do I register a shortcode to add the manual post excerpt anywhere within the same post? Does this shortcode already exist in WP?

Thanks!

2
  • If we want to run this code with the program (Code Snippets), how do we do this?
    – user233657
    Commented Jul 3, 2023 at 15:45
  • @user233657 you shouldn't post questions in the solutions box to other users questions. Code snippets support can help you, but 3rd party plugin questions are offtopic here
    – Tom J Nowell
    Commented Jul 3, 2023 at 17:02

1 Answer 1

3

Just add this to your child theme's functions.php file:

add_shortcode( 'output_post_excerpt', 'get_the_excerpt' );

Then use [output_post_excerpt]

2
  • That was quick and easy. Thanks a lot!
    – auntie
    Commented Apr 26, 2019 at 17:26
  • Hello. Can this be used with "latest posts" also? Commented Sep 22, 2021 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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