首页 文章

从wordpress仪表板的帖子和页面列的 Headers 中删除html

提问于
浏览
0

我想从附加图像中删除wordpress仪表板的帖子和页面列 Headers 中的HTML . 通常wordpress在 Headers 中不会有html标签 . 但作为插件创建的一部分,我需要删除这些htmls标签 . 我正在尝试为 Headers 字段创建Tynimce编辑器

有什么建议?

Screenshot wordpress dashboard

2 回答

  • 0

    那么,HTML就在你的 Headers 字段中 .

    为什么会这样?它绝对不是标记的正确位置 .

  • 0
    // Replace your Title Column with the Existing one //
    function replace_title_column($columns) {
    
        $new = array();
    
        foreach($columns as $key => $title) {
            if ($key=='title') 
            $new['new-title'] = __(Title); // Our New column Name
            $new[$key] = $title;
        }
    
        unset($new['title']); 
        return $new;
    }
    
    // Replace the title with your custom title
    function replace_title_products($column_name, $post_ID) {
        if ($column_name == 'new-title') {
            $cont = get_the_title();
        $cont = str_replace('&lt;', '<', $cont);
        $cont = str_replace('&gt;', '>', $cont);
        $cont = str_replace('&quot;', '"', $cont); ?>
        <a class="row-title" href="<?php echo esc_url( home_url( '/' ) ); ?>wp-admin/post.php?post=<?php echo $post_ID; ?>&action=edit"><?php echo strip_tags($cont); ?></a>
        <?php
        }
    }
    
    add_filter('manage_posts_columns', 'replace_title_column');
    add_action('manage_posts_custom_column', 'replace_title_products', 10, 2);
    add_filter('manage_pages_columns', 'replace_title_column');
    add_action('manage_pages_custom_column', 'replace_title_products', 10, 2);
    

相关问题