WordPress.org

Support

Support » Plugins and Hacks » Search Regex » Does not search within custom post types

Does not search within custom post types

Viewing 2 replies - 1 through 2 (of 2 total)
  • I would like that too. In the meantime you can customize the pluins code by yourself:

    (1) Open the searchfiles in /wp-content/plugins/search-regex/searches/
    There you will find a file for each post-field you would like tocover.

    (2) For example: Customize “post_content.php”
    In line 10 you will find the following SELECT-Statement:
    $posts = $wpdb->get_results ( "SELECT ID, post_content, post_title FROM {$wpdb->posts} WHERE post_status != 'inherit' AND post_type IN ('post','page') ORDER BY ID $orderby" );

    By default “Search Regex” is only able to cover the standard post-types “post” and “page”. If you have one or more custom post types you have to edit the (‘post’,’page’) in (‘YOUR-CUSTOM-POST-TYPE’).

    Hi KunststoffWeb – Thanks a lot. This worked for me for searching/replacing in the content area of other custom post types.

    But what about modifying the post_meta.php file to also search in custom post type custom fields? Any ideas on where to modify the code? It’s different than the post_content.php file…

    Thanks so much for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Does not search within custom post types’ is closed to new replies.
Skip to toolbar