• hello, i have installed a new theme and when i do search for content i do not get any results, when i deactivate theme my login the results show up.

    this is the code in function.php that relates to search

    function tgm_cpt_search( $query ) {
    if ( $query->is_search && !is_admin() )
    $query->set( ‘post_type’, array( ‘page’, ‘post’, ‘movies’ ) );
    return $query;
    }
    add_filter( ‘pre_get_posts’, ‘tgm_cpt_search’ );

    can i add a code to make the plugin work with my theme please.

    thank you for your help and i really like the plugin and do not want to replace it.

    all the best
    Tony

    https://www.ads-software.com/plugins/theme-my-login/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    TML has it’s own pre_get_posts action as well, but comparing the two doesn’t seem to have any collisions. Not sure…

    Thread Starter flix8918

    (@flix8918)

    I have disabled all the plugins one by one and Theme My Login does conflict with the search function, can i please remove the search function from Theme My Login and if so how do i do that.

    is there anything i can do so TML does not conflict with the search function of my theme please.

    thank you.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    I don’t know how or why it conflicts with your theme. Sorry.

    Thread Starter flix8918

    (@flix8918)

    i understand, thank you for your help and time, you have a great plugin.

    Thread Starter flix8918

    (@flix8918)

    Hello Jeff:

    in the plugin in the file class-theme-my-login.php

    protected function load() {
    $this->load_instance();
    \add_action( ‘pre_get_posts’, array( &$this, ‘pre_get_posts’ ) );

    and

    /**
    * Exclude TML pages from search
    *
    * @since 6.1.13
    * @access public
    */
    public function pre_get_posts( &$query ) {

    the conflict is that it is restricting all search functions,

    when i disable the pre_get_posts in the first paragraph above it does allow the search function but also it allows the public search to show private pages “if you search admin it will show the back-end admin page” even when the user is logged out.

    how can i disable the protection for posts only but also have the private pages be secure and not show in search results please.

    thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘not compatible with search function of my theme’ is closed to new replies.