WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #36746, comment 1


Ignore:
Timestamp:
05/05/2016 11:33:01 PM (5 years ago)
Author:
fregan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36746, comment 1

    v1 v2  
    99
    1010We were able to recover and get the permalinks working correctly by setting it to Post Name - but this is very detrimental to SEO.
     11
     12________________________________________________________
     13================ UPDATED ======================
     14
     15Someone had edited a custuom post type plugin with flush_rewrite_rules(); - commented this out, re-saved permalinks and it is now working correctly. Here is the code that was causing errors:
     16
     17{{{#!php
     18<?php
     19/**
     20 * Create post type
     21 */
     22add_action('init', 'create_project');
     23function create_project() {
     24  register_post_type('project',
     25    array(
     26      'labels' => array(
     27        'name' => 'Projects',
     28        'singular_name' => 'Project',
     29        'add_new' => 'Add New',
     30        'add_new_item' => 'Add New Project',
     31        'edit' => 'Edit',
     32        'edit_item' => 'Edit Project',
     33        'new_item' => 'New Project',
     34        'view' => 'View',
     35        'view_item' => 'View Project',
     36        'search_items' => 'Search Projects',
     37        'not_found' => 'No Projects found',
     38        'not_found_in_trash' => 'No Projects found in Trash',
     39      ),
     40      'rewrite' => array(
     41        'slug' => 'our-work/projects',
     42        'with_front' => FALSE,
     43      ),
     44      'public' => TRUE,
     45      'menu_position' => 6,
     46      'menu_icon' => 'dashicons-flag',
     47      'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
     48      'taxonomies' => array( 'snwks_project_type' )
     49    )
     50  );
     51  // Press Taxonomies
     52        $projcats = array(
     53                'name'            => 'Project Categories',
     54                'singular_name'   => 'Project Category',
     55                'search_items'    => 'Search Project Categories',
     56                'all_items'       => 'All Project Categories',
     57                'edit_item'       => 'Edit Project Category',
     58                'update_item'     => 'Update Project Category',
     59                'add_new_item'    => 'Add New Project Category',
     60                'new_item_name'   => 'New Project Category',
     61                'menu_name'       => 'Project Categories'
     62        );
     63        // register categories
     64        register_taxonomy( 'snwks_project_type', 'project', array(
     65                'labels'              => $projcats,
     66                'hierarchical'        => false,
     67                'public'              => true,
     68                'show_ui'             => true,
     69                'show_admin_column'   => true,
     70                'show_in_nav_menus'   => true,
     71                'show_tagcloud'       => true,
     72                'query_var'           => true,
     73        ));
     74  //flush_rewrite_rules();
     75}
     76}}}