Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#10759 closed defect (bug) (invalid)

Bug: wp_register_style does not allow stylesheets with parameters

Reported by: mark8barnes Owned by:
Priority: normal Milestone:
Component: General Version: 2.8.4
Severity: normal Keywords:
Cc: mark8barnes

Description

Sometimes its useful to use PHP to generate stylesheets. Unfortunately, it's not possible to pass parameters to the stylesheets because wp_register_style gets confused. For example:

wp_register_style('sb_style', get_option('siteurl').'?sermon-browser-style', false, $version);

generates

http://domain.com?sb_style&ver=1252494619

rather than

http://domain.com?sb_style&ver=1252494619

The bug is presumably in WP_Styles

Change History (3)

  • Keywords WP_Styles, wp_register_style, parameters removed
  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is not a bug, but the way that the function is intended to work. The & character by itself is an illegal entity in XHTML. So & is normally replaced with & however & is a correct html entity for the &.

This was discussed several months ago on the wp-hackers list in this thread: http://lists.automattic.com/pipermail/wp-hackers/2009-February/thread.html#25046

In short it was proven that the function is acting as expected and there are no bad side effects from the way that it does things. The thread actually refers to wp_enqueue_script but it is the same principal in the end.

my 2 cents: wp_register_style() does not return a value. The reporter must refrain to some other function then. As sivel already stated that might be obvious anyway. +1 for invalid.

Please always add the context(s) of in- and output in your reports. Thanks.

See also #9243

Note: See TracTickets for help on using tickets.