Questions tagged [post-content]

The tag has no usage guidance.

37 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
59 views

Is there a better way to programmatically insert content into a page?

During activation of the plugin I'm writing, I insert a custom page. I can add post_content using the wp_insert_post command, which seems like a reasonable way to add a limited amount of content. For ...
1
vote
0answers
12 views

How to filter post content and force every link (<a>) made in blocks to return urldecode(<a>) with readable value?

Will really appreciate your help with something. I'm using non English letters in my URL slugs. So every time I add an internal or external link with non English letters to my post (via blocks editor ...
1
vote
0answers
48 views

Bulk append custom field to post content

I want to bulk append my custom field named 'LINK' (with data like 'http://domain.com') to the end of the post content, so I can go back to using a standard theme with no support for custom fields. ...
1
vote
2answers
1k views

Get and Trim Full Post Content in WP Query

Simple task, but it isn't working: <?php $content = apply_filters( 'the_content', get_the_content() ); $contentWithoutHTML = wp_strip_all_tags($content); $pos = strpos($contentWithoutHTML, " ", ...
1
vote
0answers
153 views

current post index within content.php

I have a custom post type 'projects', I would like to add a post counter ('current project index' / 'total number projects') I would like this to show within the post content, but not sure how to ...
1
vote
1answer
532 views

WP_Query() order by post content lenght?

How do I order a post query by the length of the post content? $orderby = ?; $query = array( 'posts_per_page' => 10, 'post_status' => 'publish', 'orderby' => $orderby, 'order' => ...
1
vote
0answers
38 views

Auto-create a post with last 10 images in WordPress directory

I want to create something to help me auto-create a post with 10 last images hosted in some directory (in my server or WordPress), this code I found helps to post an image but not many images if ...
1
vote
0answers
355 views

Add Attribute to p Tag of Post Content

I would like the default <p> elements that are added to the (TinyMCE) editor when users post content, to have a dir attribute as well. Reasoning: When the editor is displayed to users, it is ...
0
votes
0answers
25 views

Inserting content from custom field to post_content

What am I doing wrong here? I'm using a theme that uses a custom field ("listing_seller_note") to save input from our user post types, and I'd like to insert this content into the ...
0
votes
1answer
16 views

How to get unmodified post content?

How do you get the unmodified post content? It seems WordPress modifies the post content. It changes the HTML by adding or removing from it. This post is different from this post: Get WordPress post ...
0
votes
0answers
16 views

Best way to add ACF fields to post_content

I have a post type and the content of every post is entirely from custom fields. Image fields, various text/wysiwyg fields, and others. There are certain plugins I want to take advantage of that rely ...
0
votes
1answer
11 views

replace control character ascii into page

I observe that a copy-paste containing the control character '^L' (ie FF) causes an error with 'vimrepress'. Wordpress publishes the page but vimpress cannot load it. I would like to replace this '^L'...
0
votes
0answers
22 views

how can i take wordpress post as embed?

how can i get an adress for using iframe in another website? Example: site.com/sample-page i will use this page in another website as iframe but only content part Example: <iframe src="site....
0
votes
0answers
27 views

Insert custom tags inside wordpress the_content();

I want to be able to insert <span class="someClass"></span> inside wordpress the_content(); is there a way to do that ? so far i have been able to to target the first paragraph through ...
0
votes
1answer
45 views

How do i truncate content length to 500 words?

Hello I would to truncate my post content to 500 words on my single page post Please how can I do this using PHP?
0
votes
0answers
185 views

Get First paragraph only (from page)

im trying to get just first paragraph from about page to home page went through some code on internet but didnt help at all function get_first_paragraph(){ global $post; $str = wpautop( ...
0
votes
0answers
700 views

Wordpress MySQL Search and replace with wildcard?

I'm trying to search and replace for a link with wildcard in phpMyadmin. If I simulate this query UPDATE wp_posts SET post_content = REPLACE (post_content, '<a style="text-decoration:none" ...
0
votes
0answers
342 views

Getting 400 Bad request Error when trying to open posts after updating to wordpress 5.0

I have some Wordpress blogs and after updating to Wordpress 5.0, I am getting same error behavior on them. Now When I open the URL of some of the posts, I am getting 400 Bad request error and on some ...
0
votes
1answer
22 views

Gallery shortcode is empty but magically creates a gallery

I have a post with only this [gallery id="file"] in text editor but in visual, there appears a gallery. I was moving these posts and updating gallery ids automatically, but these posts don't have any ...
0
votes
0answers
183 views

preg_replace style attr in $content and Editing post_content before saving

I`am trying to clean style attr from tags when saving posts and products but nothing happend. (I checked my regexp on https://regex101.com/) function filter_style_save($content) { $re = '/(<[^>]...
0
votes
1answer
504 views

How can I extract or parse data from post contents' shortcodes into an array?

I'm migrating from one Visual Page editor to another. I'm extracting the texts surrounded by the shortcode opening and closing tags. Before I write my own parsing script, I wanted to make sure that ...
0
votes
0answers
403 views

Why is every single HTML tag being stripped out of liveblog entries?

I have variously been using Livepress and the Automattic/Wordpress VIP Liveblog plugin as a live-blogging solution. However, I have run into an issue that does not seem specific to either plugin but ...
0
votes
1answer
964 views

ElasticPress - post content not displayed after custom search

I have issue with ElasticPress. After successful installation and connection of WordPress and ElasticPress and indexing few hundred posts for testing, i found everything in order until I tried to ...
0
votes
1answer
25 views

Retrieve content of page by URL Parameter

There used to be a way of displaying only the content of a page, no other template features, by using a URL parameter. I remember using this years ago, but I can't seem to find anything about this ...
0
votes
1answer
711 views

add css to only body text

In my single wordpress posts I want to apply a padding of 100px to the left and right. The problem is that when I apply it to .single .post-content the images also get a padding. However, I want all ...
0
votes
1answer
93 views

SQL trigger failes with post_content

Let me tell you my story... I was having an issue with  char visible within the post's content. Instead of editing each one, I was passing a simple query: UPDATE wp_posts SET post_content = REPLACE( ...
0
votes
1answer
278 views

Show only picture from post_content in custom RSS file

I need to do custom RSS file, And i need to show only pictuer from post_content and put it in <img> tag and remove any word, from post_content . So how can i display only images from ...
0
votes
0answers
44 views

Inline Ajax call after term is appended with a @ or # etc. displayed in div

Basically what I would like to know is how to do the following: I have TinyMCE Advanced enabled. I would like for my users to be able to tag content with different special characters (each refer to a ...
0
votes
1answer
31 views

Post content is cleared when updating

When I'm updating a post, its content is being cleared. What's wrong with the code below? add_action( 'save_post', 'eb_save_subpage_data' ); function eb_save_subpage_data() { global $post; ...
0
votes
1answer
476 views

form to post multiple inputs into post_content

I have a form, with multiple inputs that I am trying to get posted to the wordpress "post_content". I am able to get the title field and only one other field to post successfully, only when making a ...
0
votes
0answers
284 views

Add class to all parent elements inside the_content

Is there a way to add a class to all parent elements inside the_content? My problem is I'm using this kind of css selector: .post_content>* {margin-bottom:10px;} This is to due with mostly ...
0
votes
1answer
188 views

Copy url from post_content to custom field

I'm new to MySQL so I don't know if this is even possible. I would like to copy a url that's in post_content to a custom field. The url is variable and it looks like this: [audio:http://www.website....
0
votes
1answer
227 views

Post content not showing some content

I'm inserting posts by wp_insert_post function. It works like first a post is created to get its id then an image is attached to that post id. I attach images by media sideload function. Here is the ...
-1
votes
3answers
7k views

displaying content of custom post type

I have a following code for the custom post type, and I want to display the content of it inside the loop. $args = array( 'post_type' => 'gallery', 'posts_per_page' ...
-1
votes
2answers
127 views

How to show NEW post content in post editor?

In my functions.php I have: global $wpdb; $wpdb->update( $wpdb->posts, array('post_content' => $newcontent), array('ID' => $post_id) ); this code updates the post_content ...
-1
votes
1answer
322 views

Get the excerpt of post_content

Hi guys can you explain me how to get a excerpt length of 15 for the post_content in my code: <?php $args = array( 'numberposts' => '2', 'tax_query' => array( array( '...
-1
votes
1answer
4k views

Display post's description and caption

I am trying to get and display 5 featured posts. To achieve this target I have an offset of 5 recent posts. I have successfully fetched the posts' id's and images, but I failed to get every post's ...