Forums

[resolved] Plugin-development; inserting a static page (3 posts)

  1. nutsmuggler
    Member
    Posted 6 years ago #

    Hi.
    I am trying to build a plugin.I am trying to insert a static page programmatically when the plugin is installed.
    Here is the code:

    function dbes_create_events_page()
    {
    global $wpdb;
    $sql= "INSERT INTO wp_posts (post-author,post_title)
    VALUES ('admin','Eventi')";
    $wpdb->query($sql);
    }

    As you see I just inserted two fields, for a test...
    This does not work, I just get error messages...
    WHat is the right way to implement this?
    Cheers,
    Davide

  2. Denis de Bernardy
    Member
    Posted 6 years ago #

    $sql= "INSERT INTO $wpdb->posts (post-author,post_title)
    VALUES (1,'Eventi')";

  3. nutsmuggler
    Member
    Posted 6 years ago #

    Thanks a million, issue solved :-)
    Davide

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.