[wp-trac] [WordPress Trac] #41540: The rich Text widget cannot be extended (was: Plugin extending rich Text widget causes fatal error)
WordPress Trac
noreply at wordpress.org
Thu Aug 3 06:29:07 UTC 2017
#41540: The rich Text widget cannot be extended
-------------------------------+-----------------------
Reporter: hmabpera | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 4.8.2
Component: Widgets | Version: 4.8.1
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+-----------------------
Comment (by westonruter):
Here is plugin that shows how the Text widget should be exended:
{{{#!php
<?php
require_once ABSPATH . '/wp-includes/widgets/class-wp-widget-text.php';
class Extended_Text_Widget extends WP_Widget_Text {
function __construct() {
parent::__construct();
$this->id_base = 'extended_text';
$this->name = __( 'Extended Text' );
$this->option_name = 'widget_' . $this->id_base;
$this->widget_options['description'] = __( 'Extended
arbitrary text.' );
$this->control_options['id_base'] = $this->id_base;
}
}
add_action( 'widgets_init', function() {
register_widget( 'Extended_Text_Widget' );
} );
}}}
This paired with the
[https://gist.github.com/westonruter/5582d15e436bf05ce8dc78984909eff8 this
plugin] ensures that the title and TinyMCE fields will be initialized.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41540#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list