添加简码后更新失败

时间:2019-09-07 09:46:35

标签: wordpress wordpress-plugin-creation

我为youtube视频滑块创建了一个新插件。我已使用以下代码创建插件。激活此插件后,帖子和页面更新不起作用。我收到的错误是“更新失败”

我在帖子中使用了类似[az_youtube_slider]的简码。

可以请任何人帮助我修复错误。

谢谢。

<?php
/*
Plugin Name: Assistanz youtube slider
Plugin URI: https://www.assistanz.com/
Description: Get videos from youtube assistanz channel and slider
Version: 1.0
Author: Safia
Author URI: https://assistanz.com/
License: GPLv2 or later
Text Domain: assistanz
*/
if(!defined('ABSPATH')) exit;
function az_youtube_slider($atts, $content = null) {
  return "<p>Youtube video will come here</p>";
}

add_shortcode("az_youtube_slider", "az_youtube_slider");
?>

1 个答案:

答案 0 :(得分:0)

使用“经典编辑器”插件修复您的问题,您的功能也将无法使用,请使用以下内容更新您的功能。

function displayDate($atts, $content = null) {
  return "<p>Youtube video will come here</p>";
}

add_shortcode("az_youtube_slider", "displayDate");