I created a custom widget according to Widget API and it seems to work until I make changes. The save button is not triggered, this problem is only affecting this new widget.
Ps. The custom widget is also part of a dynamic_sidebar
but every other widget works fine.
The button is enabled but not triggered.
Edit. Widget code
I created a custom widget according to Widget API and it seems to work until I make changes. The save button is not triggered, this problem is only affecting this new widget.
Ps. The custom widget is also part of a dynamic_sidebar
but every other widget works fine.
The button is enabled but not triggered.
Edit. Widget code
Share Improve this question edited Apr 30, 2019 at 12:02 laviku asked Apr 30, 2019 at 11:49 lavikulaviku 1437 bronze badges 2- 2 Can you please here your custom widget code. so I can help you. – Tanmay Patel Commented Apr 30, 2019 at 11:57
- Sure, codeshare.io/2jJLDK – laviku Commented Apr 30, 2019 at 12:01
1 Answer
Reset to default 1I have checked code of codeshare.io/2jJLDK and found the issue. Please follow below instructions for fix this issue.
In the form function, you have used input type as "url" for Link and as per rule of input type "url", it can't take "#" so you must use actual url with http/https like https://www.google/ for saving/updating widget link data.*
If you want to save/update widget link data with "#" then you need to change input type as "text" like below
From:
<input type="url" name="<?php echo esc_attr( $this->get_field_name( 'link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'link' ) ); ?>" class="widefat" value="<?php echo esc_attr( $link ) ?>">
To:
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'link' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'link' ) ); ?>" class="widefat" value="<?php echo esc_attr( $link ) ?>">
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745538608a4632021.html
评论列表(0条)