Read and extract attributes from wordpress video shortcode?
<p>My purpose is to go from something like this, as taken from <code>post_content</code>:</p>

<pre><code>[video width="1080" height="1920" webm="http://path/file.webm" autoplay="true"][/video] 
</code></pre>

<p>to an array like this: </p>

<pre><code>Array( 
    width=&gt;1080, 
    height=&gt;1920,
    webm=&gt;"http://path/file.webm",
    autoplay=&gt;"true"
);
</code></pre>

<p>Of course with more or less pairs depending on what the user has entered in the video shortcode.</p>

<p>I have read the Shortcode_API and the <a href="https://codex.wordpress.org/Function_Reference/shortcode_atts" rel="nofollow">instructions</a> about <code>shortcode_atts</code>. Nowhere I can find an easy explanation on how to get those attributes in a form of an array.</p>

<p>Despite what people keep suggesting I <em>cannot</em> use <code>shortcode_atts</code> because this wordpress function requires the attributes to be <em>already in an array</em>! </p>

<p>I know how to get the above more or less done with regex. But is there any wordpress obvious way to turn shortcode attributes into an array? I know there should be.</p>

<p>As an example, this doesn't work:</p>

<pre><code>shortcode_atts( array(
                'width'    =&gt; '640',
                'height'   =&gt; '360',
                'mp4'   =&gt; '',
                'autoplay' =&gt; '',
                'poster'   =&gt; '',
                'src'      =&gt; '',
                'loop'     =&gt; '',
                'preload'  =&gt; 'metadata',
                'webm'   =&gt; '',
        ), $atts);
</code></pre>

<p>because $atts is supposed to be an array, but all I have is a string from <code>$post_content</code> which looks like this: </p>

<pre><code>[video width="1080" height="1920" webm="http://path/file.webm" autoplay="true"][/video] 
</code></pre>

<p>Please note: I am not implementing a shortcode functionality or anything like that. I just need to <em>read</em> a wordpress video shortcode as added in post content.</p>