Title: cannot exclude element
Last modified: February 20, 2022

---

# cannot exclude element

 *  Resolved [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/)
 * Hi there,
 * I am unable to exclude classes.
 * Here is my HTML:
 * > [flameshot_screenshot](https://imgur.com/K5gfOgi)
 * and here are my settings:
 * > [flameshot_screenshot](https://imgur.com/KS6wiA9)
 * But links are excluded at the HTML elements as well, and that post entry title
   is a link, so widows shouldn’t be prevented on that link.
 * I have cleared the wp-Typography plugin cache, my grid cache, and all my other
   caches, CDN, etc…
 * Am I specifying something wrong in my settings?
    -  This topic was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).
    -  This topic was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).

Viewing 15 replies - 1 through 15 (of 50 total)

1 [2](https://wordpress.org/support/topic/cannot-exclude-element/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/cannot-exclude-element/page/3/?output_format=md)
[4](https://wordpress.org/support/topic/cannot-exclude-element/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/cannot-exclude-element/page/2/?output_format=md)

 *  Plugin Author [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15384879)
 * The ignored element has to be in the string that is passed to the wp-Typography
   filter function (i.e. most of the time, part of the content markup). [Exclusion will not work for HTML in theme templates](https://code.mundschenk.at/wp-typography/frequently-asked-questions/).
   That is a technical limitation of how WordPress filter hooks work.
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15384949)
 * Could you explain where should the class or element be if not in theme templates
   in order to be able to exclude it?
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15384954)
 * It seems that all link elements are already excluded in the settings. Since my
   title is a link, and that fact is not related to templates, why it won’t be excluded?
    -  This reply was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).
 *  Plugin Author [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15384986)
 * Your post content almost certainly contains HTML elements, and your titles might.
   As stated in the FAQ, the “ignore” settings only work on elements/classes that
   are part of the content (both post titles and post content proper count as “content”,
   i.e. what’s in the database and not in PHP files).
 * Why do you believe your title to be a link “unrelated to templates”?
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15385002)
 * I understand now.
    I thought wp-Typography detects links universally by some 
   other mechanism than looking in “the content”, because exclusion of links is 
   excluded by default at the elements exclusion. It seems that it means only links
   in “the content”. If I add a span via the_title hook to all post titles, will
   that be in the content? Could you recommend a way to check what is actually in
   the content? Should I look in the database? I want to check if there are any 
   elements or classes included by default in the wp post title… Thanks!
    -  This reply was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).
    -  This reply was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).
    -  This reply was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).
 *  Plugin Author [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15385011)
 * There are not, unless you put them there when you were writing the post. If you
   add the span with a filter that runs earlier than wp-Typography’s, that should
   work, yes.
 *  Plugin Author [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15385017)
 * PS: Links (`a` elements) are not ignored in the default configuration.
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15385023)
 * Sorry then maybe I was the one who added a links to the excluded elements…
    Great,
   now I start to understand it.
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15385125)
 * Hi again,
 * I realized that my grid is actually not being affected by wp-Typography.
 * After sorting out how to exclude content, can you advise how to include all my
   grid content to wp-Typography?
 * My posts are made of post types that are assembled in a grid by a grid software.
 * So I would need to include a post type into wp-Typography.
    Is that possible?
   Thanks.
    -  This reply was modified 4 years, 3 months ago by [berry metal](https://wordpress.org/support/users/erikalleman/).
 *  Plugin Author [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15388920)
 * You can use the [API](https://code.mundschenk.at/wp-typography/api/) to add wp-
   Typography processing to an appropriate filter hook – that really depends on 
   what your grid plugin does in their post template. wp-Typography itself is not
   locked by post type, but I’m assuming your grid does not apply the `the_content`
   filter.
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15389494)
 * These are my 2 dynamic queries in the grid filter, the first for my “item” post
   type that is fetched by the grid (this is where wp-Typography is not applied),
   and the second for my related post entries (that is where wp-Typography is getting
   applied):
 *     ```
       function prefix_query_args( $query_args, $grid_id ) {
   
   
           if ( 2 === $grid_id ) {
   
       global $post;
   
       $referer = wp_get_referer();
       $post_id = wp_doing_ajax() ? url_to_postid( $referer ) : $post->ID;
   
               $terms = wp_get_post_terms( $post->ID, 'relations' );
               $query_args['tax_query'] = array(
               array(
                   'taxonomy'  => 'relations',
                   'field'     => 'term_id',
                   'terms'     =>  $terms[0],
               ),
           );
           $query_args['post_type'] = 'items';
   
           }
   
           return $query_args;
   
       }
   
       add_filter( 'wp_grid_builder/grid/query_args', 'prefix_query_args', 10, 2 );
   
       add_filter(
           'wp_grid_builder/grid/query_args',
           function( $query_args, $grid_id ) {
   
               global $post;
   
               if ( 3 === $grid_id ) {
   
                   $referer = wp_get_referer();
                   $post_id = wp_doing_ajax() ? url_to_postid( $referer ) : $post->ID;
                   $related = get_post_meta( $post_id, 'related_post_ids', true );
   
                   if ( ! empty( $related ) ) {
   
                       $query_args['post__in'] = explode( ',', $related );
                       unset( $query_args['category__in'] );
   
                   }
               }
   
               return $query_args;
   
           },
           10,
           2
       );
       ```
   
 * What is wrong with the first filter, so that wp-Typography does not get applied
   there?
 *  Plugin Author [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15392851)
 * There is probably nothing wrong with those queries, but those are not the filters
   your are looking for. I was talking about the template/function used to display
   the result your grid.
 *  Plugin Author [pepe](https://wordpress.org/support/users/pputzer/)
 * (@pputzer)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15431540)
 * Do you still need help with this, [@erikalleman](https://wordpress.org/support/users/erikalleman/)?
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15435476)
 * Hi,
 * yes, I still need help with this.
 * I use these filters:
 *     ```
       add_filter('wp_grid_builder/the_excerpt', [ 'WP_Typography', 'process' ] );
       add_filter('wp_grid_builder/the_content', [ 'WP_Typography', 'process' ] );
       ```
   
 * But I need to add a conditional like this:
 * `if ( 2 === $grid_id ) {}`
 * But because there is no function in the filters above, I don’t know how to add
   the conditional.
 * Could you (or someone else) help with the syntax?
 * Thanks.
 *  Thread Starter [berry metal](https://wordpress.org/support/users/erikalleman/)
 * (@erikalleman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/cannot-exclude-element/#post-15435495)
 * Would something like this be valid?
 *     ```
        if ( 2 === $grid_id ) {
        add_filter('wp_grid_builder/the_excerpt', [ 'WP_Typography', 'process' ] );
        }
       ```
   

Viewing 15 replies - 1 through 15 (of 50 total)

1 [2](https://wordpress.org/support/topic/cannot-exclude-element/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/cannot-exclude-element/page/3/?output_format=md)
[4](https://wordpress.org/support/topic/cannot-exclude-element/page/4/?output_format=md)
[→](https://wordpress.org/support/topic/cannot-exclude-element/page/2/?output_format=md)

The topic ‘cannot exclude element’ is closed to new replies.

 * ![](https://ps.w.org/wp-typography/assets/icon.svg?rev=2663995)
 * [wp-Typography](https://wordpress.org/plugins/wp-typography/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-typography/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-typography/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-typography/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-typography/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-typography/reviews/)

 * 50 replies
 * 2 participants
 * Last reply from: [berry metal](https://wordpress.org/support/users/erikalleman/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/cannot-exclude-element/page/4/#post-15476519)
 * Status: resolved