Without knowing the surrounding code, it is hard to tell what the problem might be,
but you said you checked the $post variable. Maybe the $post variable is not set properly, the save_post action only gives you the post id:
function get_post_title($post_id) {
$post = get_post($post_id);
if (empty($post->post_title)) {
// No title set, put in your code
}
}
add_action('save_post', 'get_post_title');
Related Posts:
- Auto save title as custom meta field value
- Execute action after post is saved with all related post_meta records (data)
- Add post meta based on another post meta value before publish post
- Get updated post meta on save_post action?
- Correct processing of `$_POST`, following WordPress Coding Standards
- Delete post meta conditionally after save post
- Set default Custom Post Meta Value
- Editing does not change post_name
- Save post meta foreach loop
- troubles with get_post_meta (and saving it)
- wp_insert_post inside save_post adds wrong metadata to inserted post
- Save frontend submission form field as custom field
- get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post
- if condition from post_meta not working in save_post
- Hide individual page title using checkbox in custom meta box?
- How do I retrieve the slug of the current page?
- How to extract data from a post meta serialized array?
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- update_post_meta and update_field ony working when saving the post
- Lack of composite indexes for meta tables
- Content hooks vs User hooks
- Save both current and new version of post meta
- get_post_meta – get a single value
- delete value 0 in post meta [closed]
- get_post_meta / update_post_meta array
- Triple meta_key on custom SELECT query
- update_post_meta not adding anything.(Nor add_post_meta)
- Identifying Importer Posts
- How metadata API works?
- How can I get values using key in Carbon Fields from Multiselect?
- How to sanitize post meta field value?
- Post IDs missing on delete_postmeta action hook
- How trigger to save post when updating post meta
- Create a Metabox that behaves Like a Taxonomy Box
- Views count with time limit per IP
- Get page->parent’s name?
- order by multiple meta_keys?
- how to get all post with the same post meta?
- update_post_meta() with a modified array?
- Echo page title from page with custom meta datetime picker
- echo image caption
- get_*_meta doesn’t always return an array
- Get Meta Key Value While Saving Post
- Generate multiple goo.gl shortlinks for qtranslate bilingual blog
- MySQL Query To Select Post By Postmeta
- Copy content stored in meta to post content
- How can I convert postmeta from unserialized to serialized?
- add_post_meta adds meta to one more different post
- Custom query, multiple custom keys
- Trying to get property of non-object error using get_post_meta()
- How can I change the tag contents of individual WordPress posts?
- get_post_meta producing white screen of death
- update_post_meta not working in plugin
- how to get a list of meta data fields assocaited with a custom post type
- Look up all posts by status or meta value – performance difference
- update_post_meta not work [closed]
- Can A Post Meta Field Store multiple values that are not in an array?
- esc_attr on get_post_meta [closed]
- Sort custom posts in archive by multiple values: date AND meta key
- How is the author’s name given a different color?
- How does WordPress treats attachments metadata in post content?
- URL to Post Meta [closed]
- Retrieving post meta array (attachment)
- Why is variable that get_post_meta stored in empty?
- Stop `update_post_meta` from working each time page refreshes?
- Displaying values from related field – if empty shows current post type’s link and title
- get_post_meta in one post only
- Best way to achieve multiple links in a post title
- Custom fields or something else
- wpdb->get_var – count author posts, meta value
- Search post overlapping dates – meta_query with meta_key
- Post Publish date not display on Umaya Child themes
- How to merge the database results into single result?
- How can I update this array built from post meta data?
- if get_post_meta function returns empty – Do Not Display HTML
- How to get the total of two meta values from different meta keys?
- Issue migrating a checkbox-type meta field to the block editor
- How to update/add child posts meta whenever the parent post meta is updated?
- Get or set values in post meta
- update_post_meta() throws Uncaught error: Cannot create duplicate attribute
- Display multiple meta_key/meta_values by single SQL query
- Using a comma instead of a pipe to separate metadata
- How do you sort the items in a custom taxonomy meta box?
- Custom meta box data not saving
- Twenty Twelve entry meta data – change and move
- How can I prevent the post_modified column in wp_posts from being updated?
- Sorting meta box values by start- and enddate and all dates in between
- Use an id on a button to update_post_meta in post
- get_post_meta image width for lazy load
- Write query according to post_meta
- Custom Fields help
- Why values dont shows in custom post column?
- get_post_meta of multiple posts?
- WP-API : post_meta not updated… but have another entry
- Parse error thrown by get_post_meta [closed]
- How to get all the related ids without array?
- Remove action of an external plugin after checking if custom post meta is set
- Update post meta array – add new, single value
- How to update post view count?