Title: Dynamic data link attributes
Last modified: November 5, 2022

---

# Dynamic data link attributes

 *  Resolved [yann1ck](https://wordpress.org/support/users/ja4st3r/)
 * (@ja4st3r)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/dynamic-data-link-attributes/)
 * Hello support team,
 * I love using GenerateBlocks and GeneratePress!
 * I am currently building a new site using the new dynamic data feature. I am using
   the dynamic links to link to other sites. I would like to add link attributes
   like open links in a new tab, but I am not able to set link attributes for the
   dynamic links. Am I missing the option or is this just not possible?
 * Thank you in advance.
 * Kind regards

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [ying](https://wordpress.org/support/users/yingscarlett/)
 * (@yingscarlett)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/dynamic-data-link-attributes/#post-16169192)
 * Hi there,
 * We can use the render block filter to achieve this.
 * 1. Add an additional CSS class to the headline block, eg. `the-link`.
    2. Add
   this filter:
 *     ```
       add_filter( 'render_block', function( $block_content, $block ) {
           if ( ! empty( $block['attrs']['className'] ) && $block['attrs']['className'] ==='the-link' ) {
               $block_content = str_replace( '<a ', '<a target="_blank" ', $block_content );
           }
   
           return $block_content;
       }, 10, 2 );
       ```
   
 * Let me know if it works.
 *  Thread Starter [yann1ck](https://wordpress.org/support/users/ja4st3r/)
 * (@ja4st3r)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/dynamic-data-link-attributes/#post-16169211)
 * Hi Ying,
 * Thank you very much for the super fast response. It worked great.
 * Kind regards
    Yannick
 *  Plugin Support [ying](https://wordpress.org/support/users/yingscarlett/)
 * (@yingscarlett)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/dynamic-data-link-attributes/#post-16174389)
 * Glad to hear that 🙂
 *  [fernandoazarcon2](https://wordpress.org/support/users/fernandoazarcon2/)
 * (@fernandoazarcon2)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/dynamic-data-link-attributes/#post-16311682)
 * Hi there! We haven’t heard back from you for a while now so we’re going to go
   ahead and set this topic as resolved. Feel free to reply if you need any more
   help.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Dynamic data link attributes’ is closed to new replies.

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

 * 4 replies
 * 3 participants
 * Last reply from: [fernandoazarcon2](https://wordpress.org/support/users/fernandoazarcon2/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/dynamic-data-link-attributes/#post-16311682)
 * Status: resolved