Location: admin_only
Duplicate Post/Page Link
// Add duplicate button to post/page list of actions. add_filter( ‘post_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); add_filter( ‘page_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); // Let’s make sure the function doesn’t already exist. if ( ! function_exists( ‘wpcode_snippet_duplicate_post_link’ ) ) { /** *…Continue reading
Display Featured Image in Post List (copy)
/* Source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html */ add_filter(‘manage_post_posts_columns’, ‘misha_featured_image_column’); function misha_featured_image_column( $column_array ) { // I want to add my column at the beginning, so I use array_slice() // in other cases $column_array[‘featured_image’] = ‘Featured Image’ will be enough $column_array = array_slice( $column_array,…Continue reading
Allow Templatera Templates to be used for Dynamic Templates
add_filter( ‘totaltheme/theme-builder/template_post_types’, function( array $types ): array { $types[‘templatera’] = ‘Templatera’; return $types; } );Continue reading
管理バーにマニュアルや外部リンクを設置する
//管理バーメニューにマニュアル設置 function add_link_other_site( $wp_admin_bar ) { if (is_user_logged_in() ){ $wp_admin_bar->add_node(array( ‘id’ => ‘manuallink’, ‘title’ => ‘マニュアル’, ‘href’ => ‘#’ )); } } add_action(‘admin_bar_menu’, ‘add_link_other_site’, 100); function add_link_target_blank() { if (is_user_logged_in() ){ printContinue reading
管理画面のメニュー制御(サイド、管理バー)
// 管理サイドバーメニューの非表示 function remove_menus(){ $user = wp_get_current_user(); if( $user-> get(‘user_login’) !== “admin_99”) { remove_menu_page( ‘edit.php?post_type=cta’ ); // CTA管理 remove_menu_page( ‘edit.php?post_type=aftag’ ); // タグ管理 remove_menu_page( ‘edit.php?post_type=afranking’ ); // タグランキング remove_menu_page( ‘siteguard’ ); remove_menu_page( ‘snippets’ ); remove_menu_page( ‘pmxe-admin-export’ ); remove_menu_page( ‘pmxi-admin-import’ );…Continue reading
デフォルトブロックのパターン削除
//デフォルトブロックのパターン削除 add_action(‘init’, function() { remove_theme_support(‘core-block-patterns’); });Continue reading
投稿一覧にスラッグを表示
//投稿一覧にスラッグ表示 function add_posts_columns_slug($columns) { $columns[‘slug’] = ‘スラッグ’; return $columns; } function add_posts_columns_slug_row($column_name, $post_id) { if( ‘slug’ == $column_name ) { $slug = get_post($post_id) -> post_name; echo $slug; } } add_filter( ‘manage_edit-post_sortable_columns’, ‘add_posts_columns_slug’ ); add_filter( ‘manage_posts_columns’, ‘add_posts_columns_slug’ ); add_action( ‘manage_posts_custom_column’, ‘add_posts_columns_slug_row’,…Continue reading
Block WP-Admin Area from Non-Administrators
add_action( ‘admin_init’, function() { if ( ! current_user_can( ‘administrator’ ) ) { wp_redirect( home_url() ); exit; } } );Continue reading
Hubspot Support Widget
function add_hubspot_embed_code() { echo ‘ ‘; } add_action(‘admin_footer’, ‘add_hubspot_embed_code’) ?>Continue reading