Directory plugin causing issues with my custom post type

I created a custom post type, and everything was working perfectly. I had some posts in, I was pulling the data into the site, and the linking was great. Once I got my custom post type working and tested it with no issues, I moved on to the directory that I needed to install. I activated your Directory plugin, and created some custom fields, and attached the custom fields to the directory listing type. Once I did that, now when I click on all of my custom posts from the custom post type I created, it brings me to a 404 error page as though the post doesn't exist.

I disabled the Directory plugin, went to the permalink section and flipped to default, and then back to %postname% and my custom posts worked again. As soon as I turned the Directory plugin back on, the same issue occurs.

Please let me know if you've ever had this issue, and if so, how to remedy it!


  • mediastead

    Also, I just check something else ...

    When I have the Directory plugin activated, I switched to default permalink and it worked ... I switch to %postname% and it does not work.

    THEN I kept it on %postname%, and even though it brought a 404 error when clicked on, I changed the link to the original link and it worked. Example of the link below:

  • PC

    Hello @mediastead

    Thanks for posting on the forums and providing additional information on the issue.

    I think we will need our lead developer to look into this to see if there can be a direct solution without using that plugin. I tried on my lab site as I already had a setup with another custom post type but could not seem to replicate it.

    The only difference is that I tested it with any other plugins disabled on my site.

    Can you please test that too and let me know if the issue you are facing is still there ?

    Please advise so that I can bring in Arnold if required.

    (Marking unresolved as of now so that it doesn't lose attention)

    Cheers, PC

  • mediastead

    Okay, so I did a quick test ... I removed the Directory plugin, and created a second new custom post type to see if it is actually multiple custom post types that was making the issue happen, and everything is working perfectly. I don't know ... there was some kind of conflict between my custom post type and the Directory plugin (because post types were being created through a separate plugin?). I am on a live client website, so I won't be able to turn all of the plugins off and go through an extensive series of tests on this site, but I made a full backup of the site and will try installing it locally to run some more tests sometime tonight or tomorrow.

    If anyone has any ideas before then, please let everyone know.


  • Arnold

    You may have a clue with the & #38 This is the numeric entity for encoding an ampersand. What sometimes happens depending on the Theme is that urls in apage get double encrypted by wpautop(); It ends up changing the ampersand in a query string into this numeric entity which then breaks the query string.

    You'd have to look through the theme code for instances of wpautop and see if they are valid calls of just CYA calls thrown in for no good reason.

  • mediastead

    I did a search through all of the function files, and there were no instances of wpautop();

    Just a quick note, I am using the Thematic framework and a child theme that I built myself. I never used the wpautop(); function, and it doesn't seem likely that it would be in the Thematic core files.

    I still have not gotten a chance to test the plugin, but I am going to include the code that I wrote to create my custom post type. The first block is all of the functions, and then I just called the last function in a custom template file to pull the custom posts in.

    /* ------------------------------- */
    /* Custom LLA Dictionary Post Type */
    /* ------------------------------- */
    function create_post_type_lla_dictionary() {
        register_post_type( 'lla_dictionary',
                'labels' => array(
                    'name' => __( 'Dictionary Items' ),
                    'singular_name' => __( 'Dictionary Item' )
            'public' => true,
            'hierarchical' => false,
            'menu_position' => 5,
            'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields', 'excerpt'),
            'taxonomies' => array('category'),
            'has_archive' => true,
            'rewrite' => array('slug' => 'dictionary')
    add_action( 'init', 'create_post_type_lla_dictionary' );  
    /* ------------------------------------------ */
    /* Custom LLA Dictionary Archive */
    /* ----------------------------------------- */
    function lla_dictionary_loop() {
    	$counter = 1; ?> 
    	<div id="llaDictionaryPosts">
    		$args = array( 'post_type' => 'lla_dictionary', 'posts_per_page' => -1, 'orderby'=> 'title', 'order' => 'ASC' );
    		$loop = new WP_Query( $args );
    		if (have_posts()) : while ($loop->have_posts() ) : $loop->the_post();
    		<div id="post-<?php the_ID() ?>" <?php post_class(p.$counter) ?>>
    			echo '<h2 class="entry-title">';
    		<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    			<?php the_title(); ?>
    			echo '</h2>';
    				if(has_post_thumbnail()) {
    					echo '<div class="entry-content">';
    					echo '<div class="entry-content-full">';
    			<?php $counter++; ?>
    		<div class="clear"></div>
    		</div> <!-- .post -->
    	<?php endwhile; else : ?>
    		<p>There are no posts to show!</p>
    	<?php endif; ?>
    	<div class="clear"></div>
  • Arnold

    I tried your post_type definition here in combination with Directory and Classifieds. When first added it did not work right because you never called flush rewrite rules(). You need to call that once after all the post_type is added. But only call it once, like in an activation routine. It's an expensive recalculation and you don't want it running on every page.

    I just went to Permalinks and resaved as is and it worked fine. This was in the 2012 theme. Added a custom field and it still worked.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.