WordPress.org

Making WordPress.org

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#1634 closed task (fixed)

Shortcode attributes get transferred to lowercase

Reported by: DekiGk Owned by:
Milestone: Priority: normal
Component: Codex Keywords: needs-patch
Cc:

Description

Hello WP team,

In the WP codex it clearly states that we can use uppercase or lowercase letters for our shortcode attribute names:

"Attribute names are optional and should contain only the following characters for compatibility across all platforms:

Upper-case and lower-case letters: A-Z a-z
Digits: 0-9
Underscore: _
Hyphen: - (Not allowed before version 4.3.0)"

http://codex.wordpress.org/Shortcode_API#Attributes

However, when I was doing one shortcode today the WP seems to have transferred my "current_post_ID" to "current_post_id".

Through the help of my WordPress Serbia facebook network I have found out that this is because the function: "get_shortcode_atts_regex" has strtolower while parsing.

Can we change the codex to reflect that?

Best Regards,
Dejan Kostevski

Change History (2)

#1 @Clorith
3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Hi, and welcome!

The codex is just a wiki, and by logging in with your WordPress.org username and password you can freely edit any page that needs some attention there, without the need for a ticket on here.

I've made the modification to the article for now, but I do believe they should always be lowercase in the backend and are permitted to use mixed case in the actual editor to simplify the input for the end user.

#2 @DekiGk
3 years ago

Hello,

Thanks. Oh, I didn`t know I can do that myself.

I disagree with the above because:

current_post_ID
current_post_id
Current_Post_Id

are 3 different names.

Anyhow, thanks for your help. Case closed. :D

Note: See TracTickets for help on using tickets.