admin管理员组文章数量:1025202
I have a simple question about admin notices. I want to display a message like 'Record updated successfully', and when user refresh again same page, then this notice should not be there as no record is updated again.
Just like settings Api, there is notice as 'Settings saved.' and when we refresh the page the notice is not there. I see in URI argument is there as
.php?page=xyz&settings-updated=true
I know here settings-updated=true is the key, and it disappear immediately and user can hardly notice it. But I don't know how it disappears after taking effect. I think I am missing very simple and basic trick.
Any help highly appreciated
I have a simple question about admin notices. I want to display a message like 'Record updated successfully', and when user refresh again same page, then this notice should not be there as no record is updated again.
Just like settings Api, there is notice as 'Settings saved.' and when we refresh the page the notice is not there. I see in URI argument is there as
http://example/wp-admin/admin.php?page=xyz&settings-updated=true
I know here settings-updated=true is the key, and it disappear immediately and user can hardly notice it. But I don't know how it disappears after taking effect. I think I am missing very simple and basic trick.
Any help highly appreciated
Share Improve this question edited Apr 8, 2019 at 12:30 W.Ahmed asked Apr 8, 2019 at 12:24 W.AhmedW.Ahmed 233 bronze badges1 Answer
Reset to default 1This is done by wp_admin_canonical_url:
- It calls wp_removable_query_args to fetch a list of query string parameters to remove, which includes
settings-updated
. It then writes some script into the page header to use
window.history.replaceState
to remove the query string from your browser's URL bar.<link id="wp-admin-canonical" rel="canonical" href="http://example/wp-admin/admin.php?page=xyz"> <script> if ( window.history.replaceState ) { window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash ); } </script>
If you want to add your own arguments to the list that gets removed then you can hook removable_query_args.
I have a simple question about admin notices. I want to display a message like 'Record updated successfully', and when user refresh again same page, then this notice should not be there as no record is updated again.
Just like settings Api, there is notice as 'Settings saved.' and when we refresh the page the notice is not there. I see in URI argument is there as
.php?page=xyz&settings-updated=true
I know here settings-updated=true is the key, and it disappear immediately and user can hardly notice it. But I don't know how it disappears after taking effect. I think I am missing very simple and basic trick.
Any help highly appreciated
I have a simple question about admin notices. I want to display a message like 'Record updated successfully', and when user refresh again same page, then this notice should not be there as no record is updated again.
Just like settings Api, there is notice as 'Settings saved.' and when we refresh the page the notice is not there. I see in URI argument is there as
http://example/wp-admin/admin.php?page=xyz&settings-updated=true
I know here settings-updated=true is the key, and it disappear immediately and user can hardly notice it. But I don't know how it disappears after taking effect. I think I am missing very simple and basic trick.
Any help highly appreciated
Share Improve this question edited Apr 8, 2019 at 12:30 W.Ahmed asked Apr 8, 2019 at 12:24 W.AhmedW.Ahmed 233 bronze badges1 Answer
Reset to default 1This is done by wp_admin_canonical_url:
- It calls wp_removable_query_args to fetch a list of query string parameters to remove, which includes
settings-updated
. It then writes some script into the page header to use
window.history.replaceState
to remove the query string from your browser's URL bar.<link id="wp-admin-canonical" rel="canonical" href="http://example/wp-admin/admin.php?page=xyz"> <script> if ( window.history.replaceState ) { window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash ); } </script>
If you want to add your own arguments to the list that gets removed then you can hook removable_query_args.
本文标签: wp list tableRemove Admin Notice on page refresh
版权声明:本文标题:wp list table - Remove Admin Notice on page refresh 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745615030a2159237.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论