• Resolved roman24reg

    (@roman24reg)


    Здравствуйте, задавал вопрос на РУ форуме, решил спросить в ветке самого плагина! Необходимо исключить создаваемые плагином ?Download Manager? страницы загрузок из поиска на сайте, т.е. при вводе запроса в поле поиска сайта ?Запрос?, сейчас выдает отдельный пост (который и должен выдаваться), а в месте с ним ?Скачать Запрос? (страница с файлом).

    До этого пользовался плагином Search Exclude, но в последнее время он чудит и не выполняет свои функции, хочет включить ?Visible? хоть десять раз редактируй…

    В общем нашел вариант… подскажите что подправить, чтобы исключить страницы загрузок… или предложите свой вариант

    function searchExcludePages($query) {
    if(!is_admin()){
    if ($query->is_search) {
    $query->set(‘post_type’, ‘post’);
    }
    }
    return $query;
    }
    add_filter(‘pre_get_posts’,’searchExcludePages’);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Nayeem Hyder

    (@nriddhi)

    Hello roman24reg,

    Hope you are well. If you want to exclude download posts in the search result in your site, please put below code in your theme functions.php,

    add_action( 'init', 'wpdm_custom_type', 99 ); function wpdm_custom_type() { global $wp_post_types; if ( post_type_exists( 'wpdmpro' ) ) { $wp_post_types['wpdmpro']->exclude_from_search = true; } }

    I hope it will work fine then

    thank you and regards

    Thread Starter roman24reg

    (@roman24reg)

    Извиняюсь, забыл отписаться в теме, что вопрос решил. Спасибо @nriddhi!

    • This reply was modified 2 months, 3 weeks ago by roman24reg.
    Plugin Support Nayeem Hyder

    (@nriddhi)

    Glad to hear that. However, if you need further help with anything else, then please don’t hesitate to open a new topic. If you get some free moments, can you please give us a 5* here https://www.ads-software.com/support/plugin/download-manager/reviews/?rate=5#new-post, It will inspire us a lot. Thanks in advance ??

    Thank you again and regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.