Front-End & Daily

How to include spaces in WordPress shortcode arguments

How to include spaces in WordPress shortcode arguments

Here's how to include a half-width space within the string of a convenient WordPress "shortcode" argument.

If you insert it as is

[addr name=東京都 千代田区]

In this way, "Chiyoda-ku" will be recognized as the second key.

$atts['name']->東京都
$atts['千代田区']->null

Enclose with quotation marks

Enclose the value with double quotation marks " or single quotation marks '.

[addr name="東京都 千代田区"]

Then you should be able to retrieve it successfully.

$atts['name']->東京都 千代田区

Comments

If you found "It was different in my environment!" or anything else, please feel free to comment.

After reviewing the content, we will publish it, omitting personal information.

Enter your name and email address

Please enter if you would like a reply by email.

We will not disclose any personal information provided. It will only be used for replies.

It will be sent directly. Please confirm and "Send".

If this was helpful, we'd appreciate your support!
Your support will be used for childcare.

Send support via OFUSE


Or support us by buying something from the buttons below
(You don't have to buy the linked product.)

Amazon

楽天市場

Yahoo!ショッピング

PR

As an Amazon Associate, "Ken" earns income from qualifying purchases.

Share

Share on Twitter Share on Facebook Share on LINE Share on Hatena Bookmark