Title: Custom Post Type URL Rewrites
Last modified: August 20, 2016

---

# Custom Post Type URL Rewrites

 *  [onei0120](https://wordpress.org/support/users/onei0120/)
 * (@onei0120)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-url-rewrites/)
 * Hey Everyone, I have made a custom post type
 *     ```
       register_post_type('services', array(
       	'label' => __('Services'),
       	'singular_label' => __('Services'),
       	'public' => true,
       	'show_ui' => true,
       	'capability_type' => 'post',
       	'hierarchical' => false,
       	'rewrite' => false,
       	'query_var' => false,
       	'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' )
       	));
       ```
   
 * And I am trying to rewrite the URLS, but every time I change rewrite from false
   to true, I get this error:
 * Fatal error: Call to a member function add_rewrite_tag() on a non-object in /
   home/sandbox/public_html/tcc/wp-includes/rewrite.php on line 51
 * What am I doing wrong!?!! Can anyone help???

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Desirity](https://wordpress.org/support/users/desirity/)
 * (@desirity)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-url-rewrites/#post-3147629)
 * Has you tried to call into a init action?
 *     ```
       add_action('init', 'my_register');
       function my_register() {
         // your code
       }
       ```
   
 * [@desirity](http://twitter.com/desirity)
 *  Thread Starter [onei0120](https://wordpress.org/support/users/onei0120/)
 * (@onei0120)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-url-rewrites/#post-3147696)
 * Wow that worked for the URL rewrite, but now I am getting a 404
 *  Thread Starter [onei0120](https://wordpress.org/support/users/onei0120/)
 * (@onei0120)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-url-rewrites/#post-3147697)
 * Nevermind! Just needed to flush the permalinks! Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Post Type URL Rewrites’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [onei0120](https://wordpress.org/support/users/onei0120/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-url-rewrites/#post-3147697)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
