Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [post-content]

The tag has no usage guidance.

0
votes
1answer
33 views

Some pages can't be updated - post_content field not updating

Background: (Site is running most recent version of WordPress on DreamHost.) This all seems to have started when I tried to get our WordPress site over to SSL. I had a certificate but going to https:...
1
vote
0answers
20 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. ...
0
votes
0answers
172 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
7 views

Skip Specific html tag From Keyword Auto link

I am really frustrated, I have tried working on this code but I am not getting it right, Though I am a novice in WP function coding. I want to skip specific html tag from my auto replace keyword with ...
1
vote
1answer
48 views

Adding current user's ID to the end of PDF hyperlinks in post content

How can I add extra parameters after a hyperlink, for tracking purposes? For example, let's say I inserted media into a post - http://mysite/wp-content/uploads/2018/12/My_PDF_File.pdf. How can I make ...
0
votes
1answer
78 views

Modifying post content with the_post action hook

I'm trying to understand the best way to modify the way that search results are displayed with my custom post type. I've got the search function working properly and giving the correct results and now ...
0
votes
0answers
164 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
18 views

Filter default_content only for products

Is there any way to use default_content only for a certain post type, specifically product (WooCommerce)? My code: add_filter( 'default_content', 'set_default_content', 10, 2 ); function ...
0
votes
1answer
26 views

Wordpress post_content gets deleted in cron after wp_update_post

I'm developing a Wordpress plugin (integrated with WooCommerce) that fetches HTML Content from an API, and add it to a WP Post as post_content into an iframe, this way: kses_remove_filters(); $...
0
votes
1answer
18 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
2answers
74 views

Website does not reflect changes on live after uploading files via FTP

I have a Wordpress site that is already published on a domain. As I wanted to update the content of some pages, I edited the local version of my website on localhost and then uploaded the files using ...
1
vote
1answer
31 views

Redirect All Search Links Containing - to + on Wordpress

I deleted all my wordpress tags via phpmyadmin, and most of my post content contains tag links, now I redirected all the tag links to search using .htaccess, I.E example.com/tag/stack-exchange/ ...
0
votes
2answers
65 views

How to display content from post_parent

Not sure what I'm doing wrong here. I am a beginner coder, but I've tried a lot of things already: I'm trying to print the_content from the post_parent of an image. Here's what I'm using right now. I ...
0
votes
1answer
25 views

Media is not showing on post page

I'm building a wordpress website based on the theme "Bulk Shop". Most of the content will be added as "post" and will be categorized into "next show", "last show", "music", "videos", etc. https://...
0
votes
1answer
37 views

Delete/Replace words from X to Y in post content

I am looking for a way to search and replace some words in my database. I have many posts on one of my blog and i want to replace words using regexes. before publishing, I marked every place I wish ...
0
votes
0answers
140 views

Get Avatar Url Weird Result and Parse Avatar URL From get_avatar() Not Working

simple task here. I need to get the url of my user's avatar so I can use it as a background-image. I tried get_avatar_url() but it oddly always gave me the wrong url, going to a gravatar domain. I ...
1
vote
1answer
118 views

Double or Single Quotes in WordPress Content Conflicting With HTML

so I know about addslashes() and related native PHP functions, but I was surprised that I wasn't able to quickly find a WordPress "catch-all" for this kind of situation, given WordPress' focus on CMS. ...
0
votes
1answer
102 views

Displaying Post Content on tooltip

I'd like to display the content of a custom post type, when hovering over a "question mark icon". In order to get the data, I used the following code (series is the custom post type): ...
9
votes
3answers
5k views

Check what Gutenberg blocks are in post_content

I'm working on a design that has different styling if a certain Gutenberg block is present on a page. In other words, if the first block is a custom built Gutenberg block, the post_title is rendered ...
1
vote
2answers
472 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
59 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 ...
0
votes
1answer
89 views

Issue with wp_insert_post() when post_content contains links?

When I create a post using wp_insert_post() if the post_content contains an HTML link I'm getting a copy of the post_content in the <head> and the <body> of my post HTML page. The strange ...
1
vote
1answer
225 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' => ...
2
votes
2answers
1k views

WordPress REST API - JSON “Rendered” Content Incorrect

i'm working in android application that use wordpress rest api to get blog from website to , i don't have any knowledge about php or wordpress , but i take some time to learn about it , any way my ...
0
votes
1answer
1k views

$content = $post->post_content; with formating

I'm trying to get formating but with no luck. My code looks like this global $post; $content = $post->post_content; And to output here <div class="tribe-events-single-event-description tribe-...
0
votes
1answer
3k views

How to implement content from external database into Wordpress text page? [closed]

What methods exist to implement data values from external database into a Wordpress text page? I think that there are two possible ways but maybe there are some more ways to realize this? Maybe ...
1
vote
0answers
48 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
37 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 ...
0
votes
2answers
217 views

Removing Extra Caption tag around image on post of WordPress

I am facing an issue when i use get_the_content() function. It displays the post content but the image in beginning of the content has some extra text around. My code is: <div class="thecontent" ...
0
votes
1answer
34 views

Some Post Content Does Not Show Up In DB Search

I am using MySQL Workbench to search for URL's in my DB, in order to use sql's update() to change them to a different URL. Easy enough. What bugs me is even then, some of these URL's, nearly all of ...
0
votes
1answer
31 views

I'm having a problem viewing the Youtube video

I'm having a problem viewing the Youtube video. In my single-custom I am using: <? Php echo wpautop ($post-> post_content); ?> And when I put the Youtube link he is not showing the video ...
2
votes
2answers
3k views

How to create WP Editor using javascript

I am trying to create some kind of repeated fields and for that, I want to create a new wp editor with some unique ID. So my question is there any way to create wp_editor using any js? same as we ...
0
votes
0answers
152 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
55 views

Stripping URLs & Email from post submissions

I want to prevent users posting in this instance of WordPress from submitting URLs and Emails in posts. I'm trying to do it via Regex but I'm not sure if I'm writing the Regex incorrectly because it ...
0
votes
1answer
290 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
1answer
42 views

Custom posttype content metabox

In a plugin I've created a custom post type that stores xml representing models in the respective posts' content. I've also created a custom meta box that allows the user to edit the xml with a ...
0
votes
0answers
261 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
98 views

Can I override the content array using the_posts filter?

So I am pretty new to WordPress and as a learning exercise I am trying to create a membership plugin that will allow the site to restrict access to pages based on user type. The first step I am ...
0
votes
1answer
575 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
20 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
620 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
1k views

Exclude posts with empty post_content in wp_query

is it possible to exclude posts with empty post content from a wp_query? $args = array( 'post_type' => array('post'), 'posts_per_page' => 5, 'post_status' => 'publish', ); $...
0
votes
1answer
463 views

post_content is stripping HTML when adding a new post? [closed]

I have the following in my functions.php file: $post_content = " Image: <img src='$featured_image' /> Address: $event_address Zip: $event_zip Region: $event_region Country: $date_country ...
1
vote
1answer
69 views

How to make search and replace in content through php

I actually can show content and change content while displaying post. Problem is that I am using RSS importer and after importing I want to make search and replace and correct data imported because I ...
-1
votes
3answers
4k 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' ...
0
votes
1answer
59 views

Format content value from DB outside of WordPress filters

We're using WordPress to maintain data for a site that gets feed into a JSON file. I've noticed that the post content we add to our file is not getting formatted appropriately. So when we feed it to ...
0
votes
1answer
74 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( ...
1
vote
1answer
121 views

Bulk updates to post_content

Ok, so I have a custom post type (let's call it 'custompost') with about 3,000 posts and each has about 150 advanced custom field data items. I am trying to update the post_content for all of these by ...
1
vote
0answers
254 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 ...
6
votes
1answer
1k views

Is there a quick way to remove inline css from all posts?

I have 40 WordPress sites with 20-30 pages on each. Most of them have some inline css, like <p style="text-align: justify;"> in every single paragraph. Is there a quick, mostly automated way to ...