WordPress.org

Ready to get started?Download WordPress

Forums

Passing category into insert post form (4 posts)

  1. jwtech
    Member
    Posted 1 year ago #

    There might be a plug-in for this, but I didn't find one.
    Is there a way to pre-check the category for a post insert? I see that you can include the post_type to the post-new.php code.
    I used categories to identify several different page items and want to make it as easy as possible for users to insert a post without having to remember which page they are posting for.
    I'm still feeling my way around what are the "better" ways to do things in WordPress.

  2. Steven Jones
    Member
    Posted 1 year ago #

    You'd have to use some jQuery for that.

    Force them to a URL like this:

    wp-admin/post-new.php?cat=Blue

    And then take the cat from the URL and select the appropriate cat.

    Not a great solution, but all I can think of at the moment as I don't think there's any native way of doing it.

  3. jwtech
    Member
    Posted 1 year ago #

    I finally found one link (albeit old) that has something that perhaps I could use, but I'm struggling how to make it work as a plugin (which the link suggests).

    http://forums.whirlpool.net.au/archive/1608032

    There is a link to the (apparently) untested code, but it makes sense. First programatically create a new post of the desired category and then redirect to the edit&post action of post.php for the new past id to allow the user to actually fill in the details and publish it.

    After reading a bunch about creating a plugin (basically one function) I'm not sure how to make it work. I'm learning with this exercise but too slowly.

  4. jwtech
    Member
    Posted 1 year ago #

    Oh, and the person with the suggestion in that thread link was a "Mike Brown". He includes a link to his suggested source code for the function.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.