There’s no way to get notifications from Facebook for a new post. You have to check by hand. Just set a transient with the desired expire time for the data so you don’t make a request on each reload, maybe check hourly for new data or every 30 mins, up to you.
As for your second question, read the docs:
https://developer.wordpress.org/reference/functions/wp_insert_post/
It automatically assigns an ID unless provided by you (which is auto-incremented by the system) but you still need to provide more things in the array, even if some are default, you might not want it like that.
Related Posts:
- Add image to post from external URL
- How to use wordpress $polylang->model->set_post_language in custom php code?
- Create WordPress posts from JSON array using plugin in admin
- Insert a Woocomerce product in specific product category
- Somehow adding to “Insert Into URL” posts are contradicting each other
- Is it possible to pin a post in second position from top
- wp_insert_post not inserting post from XML
- Creating categories while importing via CSV
- On save_post need to wp_insert_post and save partent post id to child post and child post id to parent post
- Choose default template for a page with code
- Is it possible to get a shortcode generated by a plugin, then, using a function, create a new post using that shortcode?
- How to add featured image on front end form?
- wp_insert_post() post_author and return post_id are not working
- Action hook “wp_insert_post” works but not for last imported post
- wp_insert_post hook not being called with wp_publish_post or wp_insert_post?
- wp_insert_post() get Fatal Error from Plugin
- Is it possible to add permalink when using wp_insert_post?
- Suitable hook when creating, updating and deleting posts programmatically
- Translate a plugin using .po .mo files
- How can I create a bash install script for my WordPress sites setup (WP+plugins+theme)?
- Sending all emails using SMTP
- __(): What if I have to pass in a variable?
- How to make Pull Requests on a wordpress.org plugin?
- Custom Taxonomy in plugin and template
- Should we use plugins that aren’t available from the official WordPress site?
- Where can I propose a new plugin?
- Disallow a user to post in certain categories
- Why allow overriding crucial pluggable functions wp_verify_nonce and wp_create_nonce?
- is_post_type_archive not working in feed
- How to edit plugin’s html? [closed]
- Datepicker not supporting timepicker
- Add a Custom Permalink option in the Permalink Admin Screen?
- add_filter the_content in functions.php not working
- Escape special characters in image link
- Disable WordPress password reset via mails,instead notify admin about the reset request
- Can’t use the built-in wordpress install/upgrade plugin feature [closed]
- publish_post plugin hook doesn’t always pass $post->post_content
- Let user subscribe to specific categories
- WP Customer Reviews – shortcodes
- How to get a Jewish/English event calendar on a page in WordPress?
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- How to stop xmlrpc attacks without disabling component to allow JetPack to work in WordPress?
- Make menu page link inaccessible or disabled
- Advanced Custom Fields plugin – get text from editor field and save it in a variable
- How organize uploaded media in WP?
- Archive – same title for the first two posts
- Build a list of partners with Link, Logo and text
- How to hide some section in WordPress under Post
- is there a way to link one of the field in ACF field group, to a field in a media attachment page? [closed]
- Rewrite rule not matching
- Get errors from WP_Error to different variables
- Call specific plugin update
- How to get post ID with hooks publish_post, new_to_publish, etc
- Always get creating a new table with foreign key
- Add text to variable
- Search users with custom meta data
- How to change layout of shop page in wordpress? [closed]
- override function from my plugin [closed]
- How can I achieve this, using shortcodes
- Woocommerce Product Page edit “from” text [closed]
- Edit part of a post
- Display hReviews from other websites such as yelp on your site?
- Sociable buttons displaying seemingly at random [closed]
- WordPress Membership Plugin Advice [closed]
- Hook for plugin to insert into entry-meta
- In a local wordpress installation, when I install a plugin it only offers me installation via FTP
- Use localized plugin name and description even when the plugin is disabled
- how to show new field if option selected?
- Give custom page template a custom post ID
- Bookmarking custom template pages which all have the same page ID
- Randomize post (and page) IDs on generation
- Any tips for a plugin to define specific pages navigation for specific types of users / members? [closed]
- Moving all wordpress posts from 50 websites to another website
- How to store a custom theme and update it on other installations
- One time call to external API in widget
- Hide Featured Image in AMP
- get_posts query results out of order but shows correct in php snippets plugin
- Add two row of code to the public static function init of a plugin
- How do I render content from a wp_editor in a plugin setting field?
- Only return taxonomies that are linked to a category & product
- Trying to remove a couple categories from shop page
- Enabling plugin on specific pages and subpages
- How to set plugin across network in multisite and modify it in one place?
- How can I disable Jetpack plugin on mobile?
- Using W3 Total Cache, I set expire headers to media, css and js files,but it seems doesn’t work [closed]
- Not getting result using ajax on wordpress
- Error when renaming option
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- URL Rewriting from a Plugin based on custom values
- Plugin De/Activation Not Firing On MultiSite install
- Change All Login/Signup Links in Plugin
- Buddypress Plugin for register user from other site’s [closed]
- Need plugins and themes from clients site [closed]
- Permissions question [closed]
- Output dropdown results into Woocommerce Order details
- Need help with restricted page for users
- Display Video as Post Thumbnail
- Display products based on sub-categories
- How to make horizontal scrolling menu [closed]
- how to embed a crop feature for cropping images uploaded by the user