[wp-trac] [WordPress Trac] #44344: Extending from WP_Widget_Media_Image not work
WordPress Trac
noreply at wordpress.org
Sun Jun 10 16:00:20 UTC 2018
#44344: Extending from WP_Widget_Media_Image not work
--------------------------+------------------------------
Reporter: hamedmoodi | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Widgets | Version: 4.9.6
Severity: major | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by westonruter):
@hamedmoodi Take a look at the `WP_Widget_Media_Image` class's
constructor:
https://github.com/WordPress/wordpress-develop/blob/4.9.6/src/wp-
includes/widgets/class-wp-widget-media-image.php#L24-L28
Note that it does not pass along any arguments it takes. Maybe this is a
bug, but it should be easy to work around. In your constructor, just try
setting the class variables manually after calling the parent constructor.
For example:
{{{#!php
<?php
// ...
public function __construct() {
parent::__construct();
$this->id_base = 'custom_image';
$this->name = __( 'Custom Image', 'custom' );
// ...
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44344#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list