Support » Plugins and Hacks » Gravity Forms + Custom Post Types » [Resolved] Wrong Slug Returned when Form Submitted

[Resolved] Wrong Slug Returned when Form Submitted

  • I had a GF form creating CPT posts working great last year. But over the past year of plugin and WP updates, and now reactivating this form, I receive a 404 error when the form is submitted. The form does not confirm and the custom post is not created.

    From my server error log:
    [Fri Apr 25 06:44:41 2014] [error] [client] File does not exist: /var/www/vhosts/domain.com/httpdocs/form-slug, referer: http://www.domain.com/form-slug/

    The problem is, somewhere in the process, there’s a function pulling “httpdocs” but I’m not sure where.

    I’ve deactivated all plugins (except GF 1.8.7 and GFCPT 3.0.1) and switched to a generic Genesis child theme (but added my CPT code), but the error remains.

    Ordinary GF forms that do not map to my custom post type work fine.
    I tried flushing rewrite rules, and resetting permalinks, but neither helped.

    This is a sub-directory multisite network with this form on site ID=1. There are no Capital letters in the cpt slug.

    One other thing to note: If I change permalinks back to default, everything works again. But for permalinks = Post name, we get the 404.

    I’m looking for advice about how to track down what’s now breaking this for me.


    Here is how I’m registering the CPT.

    add_action( 'init', 'rbc_register_post_types' );
    function rbc_register_post_types() {
        global $blog_id;
        //register custom post types
      rbc_register_post_type( 'Person', 'People', 'people', 'people', false, array( 'title', 'editor', 'thumbnail', 'excerpt', 'author', 'custom-fields' ) );
    function rbc_register_post_type( $type, $types, $cpt_name, $slug, $search=false, $supports, $showui=true ){
      $type2=strtolower( $type );
      $types2=strtolower( $types );
      $slug=str_replace( " ", "-", $types2 );
      $labels = array(
      'name' =>$types,
      'singular_name' => $type,
      'add_new' => 'Add New',
      'add_new_item' => 'Add New ' .$type,
      'edit_item' => 'Edit '.$type,
      'new_item' => 'New '.$type,
      'view_item' => 'View '.$type,
      'search_items' => 'Search '.$types,
      'not_found' =>  'No '.$types2.' found',
      'not_found_in_trash' => 'No '.$types2.' found in Trash',
      'parent_item_colon' => '',
      'menu_name' => $types
      $args = array(
      'labels' => $labels,
      'public' => true,
      'publicly_queryable' => true,
      'show_ui' => $showui,
      'query_var' => true,
      'rewrite' => array("slug" => $slug, "with_front" => false),
      'capability_type' => 'post',
      'hierarchical' => false,
      'menu_position' => null,
      'has_archive' => true,
      'exclude_from_search' => $search,
      'supports' => $supports
      register_post_type( $cpt_name, $args );


Viewing 1 replies (of 1 total)
  • Found the problem.

    The clue came from the fact that the 404 was generated at the server level and not via WordPress. This suggested that maybe it was a server configuration or htaccess problem.

    Found two problems. My htaccess file was not allowing Symlinks. I needed:

    Options +FollowSymLinks

    That line was commented out for some reason…. Fixed that but still no good.

    So I stripped my htaccess file down to the bones on my dev site, and suddenly we were working. Added back blocks and found this directive was causing a problem too:

    RewriteCond %{ENV:REDIRECT_STATUS} !^$ [OR]

    I removed that line and now all is well. I’m no htaccess guru, but for some reason that directive was interfering with the permalinks of this particular plugin combination.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Wrong Slug Returned when Form Submitted’ is closed to new replies.
Skip to toolbar