I think (and assuming) you use (without code, it’s hard to know, how you proceed) add_meta_boxes()
to do your job. Then your code is logically standing in custom functions.
Your function to render the metabox, don’t get the $post
global, if you didn’t define it, the function need to know from which post it must retrieve the excerpt, so you need to add global $post;
this should work
function get_excerpt_custom_metabox(){
global $post;
echo get_the_excerpt();
}
The way you want to use the_excerpt filter is not the right way. You must do it like this
add_filter('the_excerpt', 'your_excerpt_function', 10, 2);
function your_excerpt_function($excerpt, $post_id){
// do what you want,
return $excerpt;
}
Don’t hesitate to update your question with more code, if you think I’m wrong.
Related Posts:
- How do I increase the upload size only when editing special pages?
- Adding a ‘style=’ bit to image_send_to_editor output
- remove specificly the last tag in all posts
- How does printf( __( ) ); work?
- Return HTML Template Page with PHP Function
- Displaying Logged-In User Name in WordPress Menu
- Change the filename format of saved featured images
- How to use wp_insert_user on WordPress Multisite?
- Getting the comment number relative to all the post’s comments
- How do I add a php statement to a jQuery string
- Upload images and attachments from frontend form
- Config apple-app-site-association file with wordpress
- How to use the php if statement [closed]
- lazy load comments wordpress on click
- Should I use wp_mail or PHP’s mail? [duplicate]
- Successful or Error Message after running mysql code in functions.php
- How can one utilize a variable as a callback function name for add_settings_field
- Link to file in plugin directory from wordpress template?
- Using a switch statement in WordPress
- wp_handle_upload – The uploaded file could not be moved to wp-content/uploads/2012/09
- Trying to make php run in a post
- Pass PHP variable to JavaScript without inline JS
- WordPress Site Running Extremely Slow on Dedicated Server
- Where Does WordPress Make cURL Requests? How To Add cURL Option
- Using $_GET in Functions.php [closed]
- Adding nofollow to a PHP generated Nav
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- Call a PHP Function with Multiple Parameters that is outside the AJAX Handler
- Redirect undesirable domain
- WordPress Gravatar filter is removing my custom attributes
- How to make my custom widget appear within WordPress widgets? Plugin development
- Trying to install wordpress locally with mamp, but have unsupported php version
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- “imagejpeg” function is not working in wordpress
- PHP code to use on next & previouspage links
- How to optimize the IF condition with many conditions and same output [closed]
- Show latest posts in a plain HTML website custom widget [closed]
- How to list posts from a plugin taxonomy?
- How to remove coupon dropdown feature
- How to put a form with php code into a variable or shortcode?
- WordPress redirect redirecting too many times or not at all
- how to prevent wordpress admin from logging in via woocommerce my-account page
- Add html link in functions.php files of the theme
- Automatic excerpt is not shown with the_excerpt() command
- Get post categories
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Problem with custom loop and wp_list_pluck [closed]
- Output only links using wp_nav_menu()
- Update post meta – Custom field does not match meta-key
- How to add Post Tags to a new element in header.php?
- How to replace URL protocol using PHP?
- How to make the WordPress Editor not accept HTML?
- Permalinks: site.com/post-tite vs site.com/post-id/post-title for SEO and Speed
- Plugin: Front-end Editor – User role specific editable content?
- Disable category RSS Feeds on WordPress blog with PHP
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- WordPress Custom Add To Cart Button with AJAX
- Custom reduce stock code affecting date_modified – How to bypass?
- Publish button now showing content after saving
- User filter posts by year
- bp-custom.php is not working on a WordPress multisite environment. how to fix it?
- Background image no longer fits to screen now that project is in php files
- Trying to call dynamic content into a 3rd party shortcode
- Adding wp users ID into a link address from a DIVI modul
- How to add a shortcode which runs a .php file for the current post
- How to Create Carousel Indicators in PHP Loop using wp_get_attachment_url function?
- Limit Search to Product Pages only unless I’m on Blogpage or Blogposts
- WP query posts BUT show the most recent and one per author
- Block error message in foreach loop when looping through ACF field
- WordPress wrong dates bug
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- “Class Not Found” in HTML Form Target PHP File that contains the class
- shortcodes, custom php and their errors
- Looping through and combining calls to Woocommerce REST API
- Should I use wp_cache in my plugin to make it faster?
- clicking on the_tags() generated tags to show all tagged posts page
- How to change the value of a variable using input field?
- 403 Forbidden WordPress Database Results
- Difference between “Walker_Nav_menu” and “walker”
- Remove node from multisites?
- How to add custom text near category/tag title in WordPress Twenty Fifteen Theme?
- Woocommerce variable products are being added to the card on the homepage (ajax)
- user update profile for custom code
- migrating wordpress, but getting some php parsing errors
- Wp_mail doesnt work
- Use WP_Query Data In Cookie
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- Is custom behaviour possible when asynchronously uploading?
- How can I show only if custom field has content [closed]
- Top menu disapears in Category Pages when filtering using ACF
- need help to arabic text in wordpress
- Sorting Meta Fields?
- Tables not showing divs and loop/php items
- Keeping the previous get value and add another value when submitted
- Pagination not displaying
- Setting WooCommerce currency programmatically
- Masking external links with internal link for member-only
- Submit cf7 form to cfdb as pdf/BLOB [closed]
- How to use url and amin-ajax.php
- WP – Ajax call back data printed in the console.log