Преглед на файлове

:bug: content render api bug

tags/0.9.0
J преди 4 години
родител
ревизия
b6564e29ff
променени са 2 файла, в които са добавени 9 реда и са изтрити 2 реда
  1. 4
    1
      plugins/cia-endpoints/includes/class.make-endpoint.php
  2. 5
    1
      plugins/cia-endpoints/includes/formats.php

+ 4
- 1
plugins/cia-endpoints/includes/class.make-endpoint.php Целия файл

@@ -79,7 +79,10 @@ class Make_Endpoint_For extends WP_REST_Controller {
79 79
             $filtered[hero] = get_post_meta( $item->ID, 'hero_header', true );
80 80
 
81 81
             $filtered[relatedto] = p2p_related_to( $item->ID, $item->post_type );
82
-            $filtered[content] = $item->post_content;
82
+            
83
+            $content = $item->post_content;
84
+            $content = apply_filters('the_content', $content);
85
+            $filtered[content] = str_replace(']]>', ']]>', $content);
83 86
             
84 87
             if($item->post_type === 'episode') $filtered[credits] = get_post_meta( $item->ID, 'credits', true );
85 88
 

+ 5
- 1
plugins/cia-endpoints/includes/formats.php Целия файл

@@ -19,7 +19,11 @@ function default_post_format( $item, $include_content ) {
19 19
     if(!$filtered[excerpt]) {
20 20
         $filtered[excerpt] = get_the_excerpt($item);
21 21
     }
22
-    if($include_content) $filtered[content] = $item->post_content;
22
+    if($include_content) {
23
+        $content = $item->post_content;
24
+        $content = apply_filters('the_content', $content);
25
+        $filtered[content] = str_replace(']]>', ']]>', $content);
26
+    }
23 27
 
24 28
     $filtered[featured] = get_the_post_thumbnail_url($item);
25 29
     if(!$filtered[featured]) {

Loading…
Отказ
Запис