wordpressのプラグイン「Gwolle Guestbook 」でHTMLを投稿できるようにしたいのですが、
方法がわからず悩んでいます。
どのコードがHTMLを無効にさせているのか、教えていただけるとありがたいです。
よろしくおねがいします。
https://ja.wordpress.org/plugins/gwolle-gb/
試したこと:remove_actionで削除できるフックがないか探してみたがわからなかった。
php
1<?php 2 3 4// No direct calls to this script 5if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) { 6 die('No direct calls allowed!'); 7} 8 9 10/* 11 * Set meta_keys so we can find the post with the shortcode back. 12 * 13 * @param int $id ID of the post 14 */ 15function gwolle_gb_save_post($id) { 16 17 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 18 return; 19 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) 20 return; 21 if ( defined( 'DOING_CRON' ) && DOING_CRON ) 22 return; 23 24 if ( function_exists('has_shortcode') ) { 25 $post = get_post( $id ); 26 27 if ( has_shortcode( $post->post_content, 'gwolle_gb' ) || has_shortcode( $post->post_content, 'gwolle_gb_read' ) ) { 28 // Set a meta_key so we can find the post with the shortcode back. 29 $meta_value = get_post_meta( $id, 'gwolle_gb_read', true ); 30 if ( $meta_value != 'true' ) { 31 update_post_meta( $id, 'gwolle_gb_read', 'true' ); 32 } 33 } else { 34 // Remove the meta_key in case it is set. 35 delete_post_meta( $id, 'gwolle_gb_read' ); 36 } 37 38 if ( has_shortcode( $post->post_content, 'gwolle_gb' ) || has_shortcode( $post->post_content, 'gwolle_gb_read' ) || has_shortcode( $post->post_content, 'gwolle_gb_write' ) ) { 39 // Nothing to do 40 } else { 41 delete_post_meta( $id, 'gwolle_gb_book_id' ); 42 } 43 } 44} 45add_action('save_post', 'gwolle_gb_save_post'); 46 47 48/* 49 * Set meta_keys so we can find the post with the shortcode back. 50 * 51 * @param string $content Content of the post 52 * @return string $content Content of the post 53 * 54 * @since 3.1.8 55 */ 56function gwolle_gb_content_filter_for_meta_keys( $content ) { 57 58 if ( ! is_singular() || ! is_main_query() || is_admin() ) { 59 return $content; 60 } 61 62 if ( function_exists('has_shortcode') ) { 63 $id = get_the_ID(); 64 65 if ( has_shortcode( $content, 'gwolle_gb' ) || has_shortcode( $content, 'gwolle_gb_read' ) ) { 66 // Set a meta_key so we can find the post with the shortcode back. 67 $meta_value = get_post_meta( $id, 'gwolle_gb_read', true ); 68 if ( $meta_value != 'true' ) { 69 update_post_meta( $id, 'gwolle_gb_read', 'true' ); 70 } 71 } else { 72 // Remove the meta_key in case it is set. 73 delete_post_meta( $id, 'gwolle_gb_read' ); 74 } 75 76 if ( has_shortcode( $content, 'gwolle_gb' ) || has_shortcode( $content, 'gwolle_gb_read' ) || has_shortcode( $content, 'gwolle_gb_write' ) ) { 77 // Nothing to do 78 } else { 79 delete_post_meta( $id, 'gwolle_gb_book_id' ); 80 } 81 } 82 83 return $content; 84} 85add_filter( 'the_content', 'gwolle_gb_content_filter_for_meta_keys', 1 ); // before shortcodes are done. 86 87/* 88 * Make our meta fields protected, so they are not in the custom fields metabox. 89 * 90 * @since 2.1.5 91 */ 92function gwolle_gb_is_protected_meta( $protected, $meta_key, $meta_type ) { 93 94 switch ($meta_key) { 95 case 'gwolle_gb_read': 96 return true; 97 case 'gwolle_gb_book_id': 98 return true; 99 } 100 101 return $protected; 102} 103add_filter( 'is_protected_meta', 'gwolle_gb_is_protected_meta', 10, 3 ); 104 105 106/* 107 * Set Meta_keys so we can find the post with the shortcode back. 108 * Gets called from frontend/gb-shortcodes.php. 109 * 110 * @param string $shortcode value 'write' or 'read'. 111 * @param array $shortcode_atts array with the shortcode attributes. 112 * 113 * @since 1.5.6 114 * @deprecated 3.1.8 Meta keys are now set in gwolle_gb_content_filter_for_meta_keys() 115 */ 116function gwolle_gb_set_meta_keys( $shortcode, $shortcode_atts ) { 117 118 _deprecated_function( __FUNCTION__, ' 3.1.8', 'gwolle_gb_content_filter_for_meta_keys()' ); 119 return; 120 121} 122 123 124/* 125 * Check whether this post/page is a guestbook. 126 * Will test if the 'gwolle_gb_read' meta key is set to 'true'. 127 * 128 * @param bool $post_id the ID of the post to check. 129 * @return bool true if this post has a guestbook shortcode. 130 * 131 * @since 3.0.0 132 */ 133function gwolle_gb_post_is_guestbook( $post_id ) { 134 135 $meta_value_read = get_post_meta( $post_id, 'gwolle_gb_read', true ); 136 if ( $meta_value_read == 'true' ) { 137 return true; 138 } 139 140 return false; 141 142} 143
gwolle-gb/functions/gb-post-meta.php
このphpの中身にHTMLの投稿に制限をかけているコードがあるかないか、そのあたりからわからないので
教えていただけるとありがたいです。
あなたの回答
tips
プレビュー