# WordPress.org

## Make WordPress Core

Opened 6 months ago

## #40276 new enhancement

# enhancement: add a $type parameter to wp_add_inline_script() Reported by: Owned by: paulschreiber Awaiting Review normal normal 4.7.3 General ### Description It would be helpful to add a$type parameter to wp_add_inline_script().

Currently, it can only output scripts of type text/javascript. If you want something of another type, you need to either use the script_loader_tag filter (which gets run for every script), or manually add the script using a wp_head action.

This will require changing several functions:

• WP_Scripts::do_item()

Along with the data structure (array) used by add_data.

### #1 @paulschreiber 6 months ago

I originally wrote this up because of MathJax, which wants a block like this:

<script type='text/x-mathjax-config'>

An even more widespread example is the ld+json structured data Google uses everywhere:

<script type='application/ld+json'>

### #2 @ronalfy 6 months ago

+1 for this. I currently need to inline some JSON (application/ld+json) and the type parameter must be set.

Note: See TracTickets for help on using tickets.