[php] function wporg_frontend_delete_link() { $url = add_query_arg( array( 'action'=>'wporg_frontend_delete', 'post'=>get_the_ID(); ), home_url(), ); echo "<a href="{$url}">Delete</a>"; } if ( isset($_REQUEST['action']) && $_REQUEST['action']=='wporg_frontend_delete' ) { add_action('init','wporg_frontend_delete_post'); } function wporg_frontend_delete_post() { // Get the ID of the post. $post_id = ( isset( $_REQUEST['post'] ) ? get_post( (int) $_REQUEST['post'] ) : false; // No post? Oh well.. if ( empty($post_id) ) return; // Delete post wp_trash_post( $post_id ); // Redirect to admin page $redirect = admin_url('edit.php'); wp_safe_redirect( $redirect ); exit; } [/php]
CH02用戶資料
- 01取得現在用戶的相關資料
- 02確認現在用戶是否是admin
- 05current_user_can 用來判斷現在這個用戶的權利..
- 05取得現在的URL
- wordpress FTP下載plugin 出現 找不到wp-content ..
- 01 撰寫外掛plugins
- 02 增加編輯頁的sub menu
- 03 add_menu_page 設定用戶
- 04 同時可以在admin 和 author 中使用 控制台..
- 05WordPress的Action Hook與Filter Hook
- 06 wordpress filter 列表
- 後台的「說明」
- 01 admin_head 管理者後台時,head 顯示時..
- 01 HOOK 的原理
- 01官方列表
- 02 admin_notices 管理者後台時,通知管理者動作..
- 04init 添加javasscrupt 連結
- 05wp_head 添加javasscrupt 連結
- admin_footer
- register_activation_hook
- 如何加上javascript
- 設計HOOK和啟動HOOK
- 01官方列表
- 02the_content當顯示文章內容
- 02刪除post
- 03the_content修改內容
- 04mce_buttons_3, 增強編輯氣的工能..
- post_thumbnail_html 和 image_send_to_edit..