register sidebar - Save button is not working on custom widget

I created a custom widget according to Widget API and it seems to work until I make changes. The save button is not trig

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
Add a comment  | 

1 Answer 1

Reset to default 1

I 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

相关推荐

  • register sidebar - Save button is not working on custom widget

    I created a custom widget according to Widget API and it seems to work until I make changes. The save button is not trig

    8小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信