How can we help?

If you are looking for support for our PokaTheme, this is the place!

Home Forums PokaTheme support wp_insert_post doesn’t work with reviews

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #17105
    Joseph Anderson


    When I try to programmatically insert posts using PokaTheme into the “affiliates” custom post type, the posts show as published, but are not visible on the frontend until after I click “Update” in the editor.

    I’ve been researching this for hours and testing various things, but cannot find why they don’t show up.

    Here’s the code:

    $insert_post_test = array(
    ‘post_title’ => $article_title,
    ‘post_content’ => $article_body,
    ‘post_date’ => $drip_time,
    ‘post_status’ => ‘publish’,
    ‘post_type’ => ‘affiliates’,
    ‘tax_input’ => array(
    ‘lists’ => array( 198 ),
    ‘meta_input’ => [
    ‘pokafield_affiliate_tag’ => ‘Reload Bonus’,
    $insert_post = wp_insert_post($insert_post_test);

    Inserting a post into the regular “post” post_type works, and even inserting posts into custom types with other themes works.

    I even tried searching the PokaTheme files to see what could be causing this, but nothing works.

    Am I missing something, or does PokaTheme not trigger something when programmatically adding reviews?


    Joseph Anderson

    I even tried doing something super basic…

    Like inserting a post with the post_title as “asdasd” and post_content as “asdasda” without any other strings. It still doesn’t work.

    The post simply will not show until I click “Update” in the editor itself, which defeats the purpose of adding posts programmatically.


    Hi Joseph,

    There is no limitation from PokaTheme with adding posts with “wp_insert_post”.
    Most likely there is something else that is making your post saved as draft. (As I can understand this is your issue, am I right?)

    Joseph Anderson

    It’s not saved as a draft. It’s published as any other post would be, but it seems something is triggering on the backend of PokaTheme to make the post be updated on the frontend. It displays as a blank post, with no content.

    When you click “Update” in the editor, the post looks the exact same. Even the database entry is the exact same. I studied every single element of this for hours, nothing changes the initial insert post code and the “Update” in the editor.

    After all the time looking around, I can only assume that something is not triggering on the backend of PokaTheme. Something that triggers when pushing “Update” manually, but not when doing it programmatically.

    I also experimented with doing wp_update_post after wp_insert_post, but it still doesn’t work.

    I’ve tried this with dozens of other custom post types on dozens of other themes, and it’s only PokaTheme that has this issue.

    Joseph Anderson

    Need to clarify the sentence “When you click Update in the editor, the post looks the exact same.”

    What I mean to say is that, the database entry, and all the post details in the editor look the exact same.

    The only thing that’s different is there is no content being display on the frontned until you press “Update”.

    This should be easily replicable… I’ve tried it on multiple installations, and the result is always the same.


    Hi Joseph,

    This is very strange, we will make a few tests and we will get back to this.


    Hi Joseph,

    Sorry for the late reply.

    You can update to v.4.0.4 and the bug should be fixed now.

    Thank you.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.