Support » Plugins » Hacks » How to Post On-the-fly and write in DB

  • Folks,

    I have spend 6 days trying to understand how can i tweak WP, but all in vain.


    I have written a script, which pulls data from various sources on the fly.
    So, URL Structure will be like:

    And this findprod.php will use q value and pull data from other sources on the web. I want to make a Post on the Fly and then Write the post Content to Database, so that next time, if i hit the same URL (, the Find Product will not be run coz that URL’s Data has already been Cached. (Can W3 Cache Plugin Will do this all by its own?)

    In Other words, Purpose if to Mkae a Post on the Fly and write it to Database as a Cache.

    What i have Done:

    I have tried to use a fucntion wp_insert_post($ontheflypost) but where shall i put that function? In single.php of my Template or Where?

    global $user_ID;
    $new_post = array(
        'post_title' => 'My New Post',
        'post_content' => 'Lorem ipsum dolor sit amet...',
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    $post_id = wp_insert_post($new_post);

    If i put this snipper in function.php, where do i need to call this Function? Is it in single.php or where?

    HOw can i achieve what i am trying to do?

    Please help me out, i am Lost.


Viewing 1 replies (of 1 total)
  • Hello.

    I do not know PHP coding, so are you asking if you can post from a mobile device like… your cell phone? or Android media tablet ECT. (there is an app for Apple devices… so I left them out)

Viewing 1 replies (of 1 total)
  • The topic ‘How to Post On-the-fly and write in DB’ is closed to new replies.