Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如何删除wordpress post中图像的超链接?_Image_Wordpress_Hyperlink - Fatal编程技术网

Image 如何删除wordpress post中图像的超链接?

Image 如何删除wordpress post中图像的超链接?,image,wordpress,hyperlink,Image,Wordpress,Hyperlink,这是我的第一个问题 我需要在wordpress cms中的帖子中禁用我的图片上的超链接。我知道“无”按钮时,添加图像2后,但我需要某种过滤器,因为我不能重新发布所有199298931092后再次作出更改 我试着在我的主题的functions.php中为_contetn过滤器添加一些代码,但我不是那么熟练的php程序员,所以它不起作用。任何建议或帮助。请 顺致敬意, 如果您希望内容中包含所有图像: function k99_attachment_image_link_void( $content

这是我的第一个问题

我需要在wordpress cms中的帖子中禁用我的图片上的超链接。我知道“无”按钮时,添加图像2后,但我需要某种过滤器,因为我不能重新发布所有199298931092后再次作出更改

我试着在我的主题的functions.php中为_contetn过滤器添加一些代码,但我不是那么熟练的php程序员,所以它不起作用。任何建议或帮助。请 顺致敬意,

如果您希望内容中包含所有图像:

function k99_attachment_image_link_void( $content ) {
    $content =
        preg_replace(array('{<a[^>]*><img}','{/></a>}'), array('<img','/>'), $content);
    return $content;
}

add_filter( 'the_content', 'k99_attachment_image_link_void' );
function k99_image_link_void( $content ) {
    $content =
        preg_replace(
            array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                '{ wp-image-[0-9]*" /></a>}'),
            array('<img','" />'),
            $content
        );
    return $content;
}


    add_filter( 'the_content', 'k99_image_link_void' );
功能k99\附件\图像\链接\无效($content){
$content=
preg_replace(数组('{]*>}')、数组('')、$content;
返回$content;
}
添加过滤器(“内容”,“k99附件”“图像”“链接”“无效”);
如果您只需要内容中的附件:

function k99_attachment_image_link_void( $content ) {
    $content =
        preg_replace(array('{<a[^>]*><img}','{/></a>}'), array('<img','/>'), $content);
    return $content;
}

add_filter( 'the_content', 'k99_attachment_image_link_void' );
function k99_image_link_void( $content ) {
    $content =
        preg_replace(
            array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                '{ wp-image-[0-9]*" /></a>}'),
            array('<img','" />'),
            $content
        );
    return $content;
}


    add_filter( 'the_content', 'k99_image_link_void' );
功能k99\u图像\u链接\u无效($content){
$content=
预更换(
数组(“{]*>”),
$content
);
返回$content;
}
添加过滤器(“内容”、“k99图像”链接“无效”);

如果您希望内容中包含所有图像:

function k99_attachment_image_link_void( $content ) {
    $content =
        preg_replace(array('{<a[^>]*><img}','{/></a>}'), array('<img','/>'), $content);
    return $content;
}

add_filter( 'the_content', 'k99_attachment_image_link_void' );
function k99_image_link_void( $content ) {
    $content =
        preg_replace(
            array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                '{ wp-image-[0-9]*" /></a>}'),
            array('<img','" />'),
            $content
        );
    return $content;
}


    add_filter( 'the_content', 'k99_image_link_void' );
功能k99\附件\图像\链接\无效($content){
$content=
preg_replace(数组('{]*>}')、数组('')、$content;
返回$content;
}
添加过滤器(“内容”,“k99附件”“图像”“链接”“无效”);
如果您只需要内容中的附件:

function k99_attachment_image_link_void( $content ) {
    $content =
        preg_replace(array('{<a[^>]*><img}','{/></a>}'), array('<img','/>'), $content);
    return $content;
}

add_filter( 'the_content', 'k99_attachment_image_link_void' );
function k99_image_link_void( $content ) {
    $content =
        preg_replace(
            array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                '{ wp-image-[0-9]*" /></a>}'),
            array('<img','" />'),
            $content
        );
    return $content;
}


    add_filter( 'the_content', 'k99_image_link_void' );
功能k99\u图像\u链接\u无效($content){
$content=
预更换(
数组(“{]*>”),
$content
);
返回$content;
}
添加过滤器(“内容”、“k99图像”链接“无效”);

不幸的是,添加这些链接后,没有简单的方法可以删除它们。这些链接基本上是围绕您文章内容中的图像进行“硬编码”的。恐怕您必须浏览所有199298931092篇文章,并在编辑每个图像时通过单击链接选项的“无”手动删除这些链接。未来会有一些提示f方法所以这不会一直发生,请看这里:事实上是这样的……我找到了解决方案,但我会在插件中实现它。Cya很快会使用dowload链接和教程。幸运的是,在添加链接后,没有简单的方法可以删除这些链接。这些链接基本上是围绕您帖子内容中的图像进行“硬编码”的。恐怕您不得不这样做浏览所有199298931092帖子,在编辑每张图片时,通过点击链接选项的“无”手动删除链接。这里有一些经得起未来考验的方法,所以这种情况不会一直发生,请参见:事实上,这是…我找到了解决方案,但我将在插件中实现它。Cya很快将使用dowload链接和教程