Support » Fixing WordPress » Custom Post Types not queried in "Link existing content"

  • In a post, linking to existing content displays custom post type posts. However, when using the search box, the results displayed only include Posts and Pages – and excludes my custom post types. Any ideas?

    This is how I’m registering my post type:

    register_post_type( 'journal',
    		  array( 'label' => 'Journals',
    		    'description' => 'Articles, videos, links, photo albums.',
    		    'public' => true,
    		    'show_ui' => true,
    		    'publicly_queryable' => true,
    		    'show_in_menu' => true,
    		    'capability_type' => 'post',
    		    'hierarchical' => false,
    		    'rewrite' => array('slug' => 'journals', 'with_front'=>false, 'feeds' => true),
    		    'query_var' => true,
    		    'has_archive' => true,
    		    'exclude_from_search' => false,
    		    'menu_position' => 7,
    		    'supports' => array(
    		    'taxonomies' => array(
    		      // Custom Taxonomies are assigned with register_taxonomy()
    		    'labels' => array (
    		      'name' => 'Journals',
    		      'singular_name' => 'Journal',
    		      'menu_name' => 'Journals',
    		      'add_new' => 'Add Journal',
    		      'add_new_item' => 'Add New Journal',
    		      'edit' => 'Edit',
    		      'edit_item' => 'Edit Journal',
    		      'new_item' => 'New Journal',
    		      'view' => 'View Journal',
    		      'view_item' => 'View Journal',
    		      'search_items' => 'Search Journals',
    		      'not_found' => 'No Journals Found',
    		      'not_found_in_trash' => 'No Journals Found in Trash',

    It may be worth noting that similar functionality in the light-weight related-links plugin does find custom-post-types using the identical looking search.


Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m guessing the way to track this down will be through TinyMCE and how that particular button queries the database.


    I found this post through Google, as I’m having the same issue. I tracked the search functionality down to the “wp_link_query” function in /wp-includes/class-wp-editor.php (~line 755), so I experimented, and at least with setting “suppress_filters” to false, I was able to get one custom post to appear, but not others. It seems to be searching content only, rather than title and content, in my case.

    Just for the record, I’m using:

    Theme: Custom, based on the Roots WordPress theme
    Plugins: both Pods and Events Manager

    The Pods-created custom types results are the ones that duplicate, for me, the issue you describe.

    Basically, the search pulls up Events Manager Events that contain the search phrase, the expected behavior, but not the related Pods content types whose titles include the search terms (Performers, etc.)

    Have you made any progress?

    I abandoned trying to link related posts in the content editor because – as you discovered – I got the feeling that it was an issue with core.

    I worked with the designer to instead add related links in a sidebar using which does include custom post-types.

    Here’s a demo on our temporary dev site:

    The “In this journal” section is created using the Related Links plugin.

    Hi catapultparlor,

    There is a new plugin for that:

    You should use it together with the plugin Search Everything.

    hope this helps!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Post Types not queried in "Link existing content"’ is closed to new replies.