WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Types not queried in "Link existing content" (5 posts)

  1. catapultparlor
    Member
    Posted 1 year ago #

    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(
    		      'title',
    		      'editor',
    		      'excerpt',
    		      'custom-fields',
    		      'thumbnail',
    		      'author',
    		      ),
    		    '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.

    Thanks!

  2. catapultparlor
    Member
    Posted 1 year ago #

    I'm guessing the way to track this down will be through TinyMCE and how that particular button queries the database.

  3. efost
    Member
    Posted 1 year ago #

    Hi,

    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?

  4. catapultparlor
    Member
    Posted 1 year ago #

    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 http://wordpress.org/support/view/plugin-reviews/related-links which does include custom post-types.

    Here's a demo on our temporary dev site: http://dev.puppeteers.org/puppetry-journal/journals/spring-2011-volume-62-no-3/

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

  5. nonverbla
    Member
    Posted 1 year ago #

    Hi catapultparlor,

    There is a new plugin for that:

    http://wordpress.org/plugins/b09-link-to-existing-content/

    You should use it together with the plugin Search Everything.

    hope this helps!

Topic Closed

This topic has been closed to new replies.

About this Topic