Try using the $post parameter:
add_action( 'pending_to_publish', 'sa_ads_count' );
function sa_ads_count( $post )
{
// use the $post variable here, not the missing global.
}
Related Posts:
- Visual Studio SignTool.exe Not Found
- How can I set a draft page as parent without publishing?
- Display a post’s publish date from 2112
- Does blocking xmlrpc.php affect pinging update services like pingomatic
- I can’t preview post’s change once they are published
- How to access the post meta of a post that has just been published?
- How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
- Publish post when edit post form submitted with enter/return pressed on keyboard
- Access post meta just after publishing
- How to make scheduled post preview visible to anyone?
- Scheduled Posts and wp-cron – Why don’t scheduled posts publish if too old?
- Why does publish_{custom-post-type} fire on update?
- Show recent published posts
- Is there a way to know if a post has been published through XML-RPC?
- How to unpublish a page and still keep a draft?
- get_terms on save_post hook
- Save and Publish button not working after installing SSL
- Disable “preview changes” button
- Can we have private drafts?
- Can’t schedule post for another time
- publish_post called too early
- Custom save button shows ‘Are you sure you want to…’ dialog
- Calling Different Custom Post Timestamps in a table
- Get publish post link?
- Bulk update all posts from plugin settings screen
- Controlled publishing in WordPress
- Change the text of the publish button to Save
- Can’t publish custom post type – “You are not allowed to edit this post.”
- problem with publish date not always appearing [duplicate]
- Get only used meta_values
- What is happening to make my Update/Publish button disabled?
- What is the reason for the new_to_publish hook not working?
- After I publish a post where does it go
- Should you manually ping new WordPress posts?
- How can I tell if a post has been published at least once?
- Authors should not publish
- How to add custom status to quick edit
- I need to modify drafts using custom data from database and then publish it
- How to show or hide a post based on meta_value selection?
- i am making text changes on my page show in preview not on live site, why? [closed]
- Is WordPress “publish” atomic?
- How to move post process to background
- Meta field bulk editing no longer working in WP 6.0 [closed]
- How does redirect work when publish date changes and date in url changes?
- Gutenberg publish date datepicker
- How Google Indexer should only index published pages
- Bulk Post update_post_meta
- Publish and go to page [duplicate]
- Publish Post Action Not Working
- Is it normal for a scheduled post to say “Missed Schedule”
- Manage multiple wordpress installs (Best Practice)
- Access post meta just after publishing
- Publish post and create additional posts with same content
- Disable Facebook Comments Automatically On CPT
- update_post_meta() not working in bulk option
- Showing the next post’s title, even if it’s an unpublished post
- Force Publish Future (Scheduled) Posts Immediately [duplicate]
- Can’t publish posts, Jetpack won’t connect, empty notification emails to my inbox [closed]
- Duplicate post on publish
- How is it possible to use a very reduced version of WordPress?
- Problems in updating a self-developed plugin
- When i save or publish a post setting reset wp
- How do I retrieve the slug of the current page?
- Query all posts where a meta key does not exist
- Most efficient way to get posts with postmeta
- How to only display posts whose meta_value field is not empty?
- Get posts by meta value
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- what is the correct way to compare dates in a WP query_posts meta_query
- How to hook update_post_meta and delete_post_meta?
- Explanation of update_post_(meta/term)_cache
- How to extract data from a post meta serialized array?
- Can I exclude a post by meta key using pre_get_posts function?
- Post meta vs separate database tables
- Advanced search form with filters for custom taxonomies and custom fields
- How to update custom fields using the wp_insert_post() function?
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- Can wp_query return posts meta in a single request?
- order by numeric value for meta value
- Attaching taxonomy data to post with wp_insert_post
- Passing error/warning messages from a meta box to “admin_notices”
- Optimize post insert and delete for bulk operations?
- Add “upload media” button in meta box field
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- Display Yoast WordPress SEO title in archive template
- Custom bulk_action
- Why WordPress choose data serialization over json_encode?
- How to make search include data from wp_postmeta?
- How can I delay the publishing of a page or post?
- Meta query with boolean true/false value
- How can I get the post ID from a WP_Query loop?
- Why are simple updates to wp_postmeta’s “_edit_lock” so slow?
- How to check if post meta key exists or not in wordpress database
- Custom post meta field effect on the performance on the post
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- How to get custom post meta using REST API
- How do I query for posts by partial meta key?
- Difference between meta keys with _ and without _ [duplicate]
- How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button