Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorry for posting again so soon, but another thing that appears to work is setting

    'rewrite' => false

    Not sure if this helps come to a solution?

    I still can’t get this to work…

    The ONLY way it works is by adding flush_rewrite_rules() in the function which creates the post type. But from what I understand, this isn’t good to do.

    I’ve tried a number of things:

    • rewriting the slug
    • changing the permalinks under settings
    • making sure page names and custom posts aren’t the same
    • clearing the rewrite rules from the database
    • Flush rewrite – which only works when it’s permanently there

    Is there anything else I can try?

    Link: https://alive.barasites.com/

    // CUSTOM POST TYPE
    add_action( 'init', 'create_post_type' );
    
    function create_post_type() {
      register_post_type( 'Events',
        array(
          'labels' => array(
            'name' => __( 'Events' ),
            'singular_name' => __( 'Events' )
          ),
          'public' => true,
    	  'supports' => array('title','editor','author','thumbnail','excerpt','comments')
        )
      );
    
      register_post_type( 'Sermons',
        array(
          'labels' => array(
            'name' => __( 'Sermons' ),
            'singular_name' => __( 'Sermons' )
          ),
          'public' => true,
    	  'supports' => array('title','editor','author','thumbnail','excerpt','comments')
        )
      );
    
      register_post_type( 'Photo Gallery',
        array(
          'labels' => array(
            'name' => __( 'Photo Gallery' ),
            'singular_name' => __( 'Photo Gallery' )
          ),
          'public' => true,
    	  'supports' => array('title', 'thumbnail')
        )
      );
      flush_rewrite_rules();
    }

    Thanks esmi – worked and saved me what could have been so much time!

    Matt – Bara’ Design

    Genius!
    Wordpress please implement this in the next version. Very helpful for lightbox style things ??

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