Title: Hook for default attributes
Last modified: March 8, 2024

---

# Hook for default attributes

 *  [Cheon, YoungMin](https://wordpress.org/support/users/082net/)
 * (@082net)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/hook-for-default-attributes/)
 * [https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#change-block-defaults](https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#change-block-defaultshttps://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#change-block-defaults)
 * Document says that we can override default but not, because the init() function
   calls register_editor_assets() directly and ‘syntaxHighlightingCodeBlockType’
   declared with ‘const’ so that we cannot override 🙁
 * Please just add hook for default attributes,
 *     ```wp-block-code
       syntax-highlighting-code-block.php:191
       function init() {
       ......
       $attributes = [
           'language'         => [
               'type'    => 'string',
               'default' => '',
           ],
           'highlightedLines' => [
               'type'    => 'string',
               'default' => '',
           ],
           'showLineNumbers'  => [
               'type'    => 'boolean',
               'default' => false,
           ],
           'wrapLines'        => [
               'type'    => 'boolean',
               'default' => false,
           ],
       ];
       $attributes = apply_filters( 'syntax-highlighting-code-block-attributes', $attributes );
   
       ......
       }
       ```
   
 * And languages ( not every sites needs All supported languages 🙂 )
 *     ```wp-block-code
       syntax-highlighting-code-block.php:460
       function get_language_names() {
       	$languages = require __DIR__ . '/language-names.php';
       	return apply_filters( 'syntax-highlighting-code-block-languages', $languages );
       } 
       ```
   
 * Thanks in advance
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhook-for-default-attributes%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/hook-for-default-attributes/#post-17560985)
 * I’m not sure I understand. The `syntaxHighlightingCodeBlockType` variable is 
   supposed to be populated with the block type’s default attributes which I show
   being able to be overridden in [https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#change-block-defaults](https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#change-block-defaults)
 * Is that not working?

Viewing 1 replies (of 1 total)

The topic ‘Hook for default attributes’ is closed to new replies.

 * ![](https://ps.w.org/syntax-highlighting-code-block/assets/icon.svg?rev=3406002)
 * [Syntax-highlighting Code Block (with Server-side Rendering)](https://wordpress.org/plugins/syntax-highlighting-code-block/)
 * [Support Threads](https://wordpress.org/support/plugin/syntax-highlighting-code-block/)
 * [Active Topics](https://wordpress.org/support/plugin/syntax-highlighting-code-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/syntax-highlighting-code-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/hook-for-default-attributes/#post-17560985)
 * Status: not resolved