• Resolved evbof7734

    (@evbof7734)


    I am writing a widgit that inserts a post into a protected area (only one special user can edit)
    However, I am rather new to php.
    Right now, my assumption is that as I build $post I will need to do something like:
    ‘post_edit_cap’ => ??????
    but I have no idea what ?????? should be.
    I tried
    ‘post_edit_cap’ => get_user_label (“userlabel_1_uncleprotected”)
    but that did not work. Upon further examination I am not surprised it did not work. As I mentioned, I am very new to php. Based on limited knowledge it seems to me that post_edit_cap is more than a mere integer.
    Can you help me on this? Not only would you be helping me with your own plugin, you would also be giving great insight into php for a noob.

    https://www.ads-software.com/plugins/wp-access-areas/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter evbof7734

    (@evbof7734)

    I have continued to fiddle with things.
    I am at this point and I am stymied.
    I have setup a $post with an author, contents, and all that jazz. I then try the following:

    $post['post_edit_cap'] = 'userlabel_1_uncleprotected';
            $post_id = wp_insert_post($post);

    I have also tried double quotes.

    Thread Starter evbof7734

    (@evbof7734)

    It would seem I had set all my post array incorrectly.
    I have a very basic button working right now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating Post via code’ is closed to new replies.