Snippet: Disable Visual Editor on Listings Page


This snippet lets you disable the visual editor on listing pages

Read here to find out about how to add code snippets to your site.
if( is_admin() ) {
    /**
     * Disable Visual Editor on Listings Edit Page
     * 
     * @param $can
     *
     * @return false|mixed
     */
    function wpsight_disable_visual_editor( $can ) {

        if( 'listing' === get_post_type() ) {

            return false;

        };

        return $can;

    }
    add_filter( 'user_can_richedit', 'wpsight_disable_visual_editor', 50 );

}

Was this article helpful? Yes · No