Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#7984 closed feature request (invalid)

JS inline post is not coherent with PHP inline post

Reported by: Malaiac Owned by: azaozz
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: JavaScript Keywords: needs-patch dev-feedback
Focuses: Cc:


In Javascript : ( /wp-admin/js/inline-edit-post.js?ver=20081023 )

var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'post_password'];
		if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
		if ( t.type == 'post' ) fields.push('tags_input');

in PHP : ( wp-admin/includes/template.php, function inline_edit_row() starting line 877)

switch($column_name) {
/* ... */
  if ( $bulk )
    do_action('bulk_edit_custom_box', $column_name, $type);
    do_action('quick_edit_custom_box', $column_name, $type);

Any mod/plugin using an extra field may manage it by PHP (with (quick_edit_custombox,'my extra field').

But it cannot access javascript and add the extra field name to fields[]

Using revision 9368

Change History (9)

comment:1 westi5 years ago

  • Keywords needs-patch added

comment:2 Malaiac5 years ago

Same problem, even without custom fields.
what if a plugin dev / WP webmaster wants to propose a categories dropdown instead of a checklist (to force one category per post).

PHP side, replace wp_category_checklist() by wp_dropdown_categories() ( regular WP way)
Javascript side... wth ? duplicate inline-edit-post.js with 2 lines changed ?

comment:3 markjaquith5 years ago

  • Milestone changed from 2.7 to 2.8


comment:4 azaozz5 years ago

JS (unlike php) can easily be overloaded/functions redeclared. The way to do that here would be to copy inlineEditPost.edit(), change it to handle the new/custom values and replace the original one by registering the script with dependency on inline-edit-post.js so it's always loaded after.

comment:5 follow-up: gcorne5 years ago

Perhaps, plugin functionality could be added to WP js code that mimics the behavior of add_action and add_filter from the PHP side of things.

comment:6 Denis-de-Bernardy5 years ago

  • Milestone changed from 2.8 to Future Release

that would be sweet, but it would definitely need a patch

comment:7 Denis-de-Bernardy5 years ago

  • Component changed from Administration to JavaScript
  • Keywords dev-feedback added; inline-edit removed
  • Owner changed from anonymous to azaozz
  • Type changed from defect (bug) to feature request

and Andrew's opinion.

comment:8 in reply to: ↑ 5 azaozz5 years ago

Replying to gcorne:

Perhaps, plugin functionality could be added to WP js code that mimics the behavior of add_action and add_filter from the PHP side of things.

It it possible but a lot easier would be for plugins to add their own functions or redefine the existing. For most places both js and css have to be added.

comment:9 Denis-de-Bernardy5 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

@gcorne: these would be the admin_footer-$page hooks, unless I'm mistaking.

closing this as invalid.

Note: See TracTickets for help on using tickets.