Support » Fixing WordPress » Add a New Post button on category view

  • I want to add a button on category view so that when the button is pressed it sends the users to Add New Post page WITH the current category checked by default. I dont want the users to manually select the category checkboxes if they were redirected from a category view.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Well, the way to do that would be to use $_GET data from the URL. WordPress does this by default for a few fields (for example the title). If you pass the query string ?post_title=Title to the edit-post URL, it will auto-populate the title field.

    The problem is, I don’t think it does this by default for the post category. You would have to write a plugin that intercepts the category checkbox list output and alters it based on $_GET data (also not sure if there’s a hook for that).

    I think it should be like /post-new.php?cat_ID=2 or something like this.
    I’ve gone through the post-new.php and edit-form-advanced.php on notepad but i couldn’t figure it out. I’m not too good at php.

    I’ve browsed through the source and tracked it down to the function wp_terms_checklist in the file /wp-admin/includes/template.php. Unfortunately, I still don’t see any indication that any $_GET data is actually taken into account to determine which boxes are checked.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add a New Post button on category view’ is closed to new replies.