#7981 closed defect (bug) (fixed)
Fix category ID selector in WordPress.tv editor
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | WordPress.tv | Keywords: | has-patch |
Cc: |
Description
In one of the last versions of WordPress, the code for each checkbox in the categories meta tag of the classic editor has changed from:
<input value="107686937" type="checkbox" name="post_category[]" id="in-category-107686937">
to:
<input value="107686937" type="checkbox" name="post_category[]" id="in-category-107686937-2">
That "-2" breaks the selector of the javascript used in the WPTV editor to apply categories.
The change has tobe made in line 523 of https://meta.svn.wordpress.org/sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php
I include the required patch, with base in
https://meta.svn.wordpress.org/sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/
Attachments (2)
Change History (8)
#1
@
7 weeks ago
Why has the -2
appeared here? Do you have any link to the changeset / etc that's caused it? Just to avoid changing this only for it to reappear sometime.
#2
@
7 weeks ago
I can't find the changeset, but the HTML of the elements in the categories metabox is now like this:
<li id="in-category-2757063-1"> <label class="selectit"> <input value="2757063" type="checkbox" name="post_category[]" id="in-category-2757063-2" checked="checked"> 2025 </label> </li>
The <li> tag has now a -1 and the checkbox a -2 to prevent duplicate ids
The javascript from the editor uses that id to query the element, grab the title and check it when clicked.
There's a hundred better ways of doing this, but for now it's just a hotfix until we have a new version.
This ticket was mentioned in Slack in #wptv by nilovelez. View the logs.
3 weeks ago
#4
@
2 weeks ago
- Owner set to dd32
- Resolution set to fixed
- Status changed from new to closed
In 14472:
#5
@
2 weeks ago
Source of the change in IDs https://core.trac.wordpress.org/changeset/58894
Sync'd to WordPress.com and deployed there too now.
Sorry for the delay @nilovelez
Patch file to add the "-2" sufix