Hard to say what your issue is without seeing more code, but I would bet that your issue will be resolved if you add this after inserting your post:
do_action('save_post', $post_ID, $post);
WordPress uses this action to flush cache, rewrite rules, etc. Make sure to use the appropriate variables for $post_ID and $post, of course. For good measure, you should also add:
do_action('wp_insert_post', $post_ID, $post);
Just so any plugins, themes, etc. which use this hook will know to do whatever it is they do.
Cheers~
Related Posts:
- A way to automatically install pages on theme install?
- Is it possible to manipulate the list of page templates?
- Pages: frontpage.php, home.php, posts page etc
- Posts in multiple Categories different single.php
- Hide certain pages / posts on wp-admin, show custom filter
- Cache Busting using htaccess Rewrite rule?
- the_excerpt() not showing manual excerpt for Pages
- How to highlight the current page in the nav menu?
- Do I really need the div class entry?
- Displaying part of every child page?
- How do I get the next page of posts link?
- Where can I access my custom page template?
- using jQuery Cycle by Malsup with WordPress Page and Gallery
- How to display posts in hyperlink with nested slugs?
- Force a specific template based on the URL
- Excluding Pages not working
- Highest number of WordPress Custom Page Templates?
- WordPress custom post type permalink: website.com/post-name/post-id
- Multiple TinyMCE Editors in one Admin Page
- Create a new page in WordPress theme
- How to create a custom page(not a template) in a theme
- Multisite theme path rewrite using .htaccess
- how to setup custom content structures
- How to Find the Page the Front Page is Using?
- How to place HTML tags in content from the_content()?
- Need help with adding templates (archives and sitemap) to WordPress child theme
- Template for landing pages
- Issue On Displaying Pages with Post Name Permalink
- Why in the static pages of my theme are showing these information?
- Remove specific published page when theme deactivated
- Migrating to WordPress – but how will it do “structured” data?
- How to code custom special page
- How to add custom meta box when you have a custom page template file
- How to track a users last visited page?
- WordPress Load Only Page Text
- How to add pages in wordpress using codes?
- How does the loop know which post to view?
- Pagination fuction in shortcode always displays on top
- Injecting pre-defined text from custom page template to editor
- Theme development: menu links a tabbed page with page jumps
- Custom theme template files
- Parent/Child pages
- WordPress Animation Adjustments
- Show only pages you are author of
- How do I open a post in a custom page in wordpress?
- Pages not displaying as sections on static page
- How to show metabox on page if it is using a template
- makeing a terms of use page that is part of the theme
- Creating a theme just to deploy a single page
- Problem with Displaying Custom Theme Page’s Content
- WordPress Twenty-Fourteen: How to Remove Home Page Header Image from Other Pages
- Alter theme pages on language switch
- wp_editor some functionality not working on custom theme
- Display content on Single page
- One-Page WordPress Template
- How to create multiple pages in a client theme?
- How can I display and excerpt of all pages with a meta_key and meta_value on index.php?
- Advantages/Disadvantages Using Theme Editor Instead of Pages
- Can you create a custom page with content in the center already defined?
- how to make a new page affected by a theme’s index.php layout?
- How get the 10 most viewed pages (not post)
- How can I change the title of the Home link in the navigation bar?
- The content not wrapped in paragraph tags with get_page_by_title()
- Standard Way To Do Custom Work Within A Page?
- How do I get information about a page, such as featured image, except, and title?
- Programatically add a page in WordPress
- Configuring static page with add_rewrite_rule gives 404 after navigating to Permalinks admin panel
- Get the first image from post content (eg.: hotlinked images)
- Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?
- Grab the first paragraph of each post
- Convert a static website to a WordPress theme and import all existing content
- posts_nav_link(); not showing up on static pages
- Loading files for theme and child theme (Require)
- Move theme templates to subfolder without losing page associations
- Can’t delete theme
- Is it a bad practice to use switch_to_blog in the frontend?
- Arguments ignored/markup changed in wp_nav_menu if no menu is selected
- Theme name passed into some of the functions?
- paged > max_num_pages won’t throw 404
- Apply different Class for each element in a foreach()
- Getting custom posts by post id from cutomizer text input
- How to wrap all titles generated by Gutenberg “Heading” block with tag
- In creating a theme, how can i allow a user to change an image outside post/page content?
- What template file is used for homepage pagination?
- WordPress theme resource won’t load over VPN
- Display Featured Posts Grid on Static Page (Gazette)
- Unwanted empty line at the beginning of document
- Why is my container argument not working for wp_nav_menu() [closed]
- Translate a theme with a PO file
- All pages are the same
- How to Split loop in multiple column in archive page
- Warning: This page allows direct access to your site settings. You can break things here. Please be cautious!
- bbPress: modifying template for forum index
- control posts order by select option
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- Load get_page_templates into select menu
- WordPress two sidebar layout or theme
- add_action not working in header?
- Recent posts with comment count in “Sidebar” template [closed]
- HTML to WORDPRESS [closed]