Vincredible
Forum Replies Created
-
Hello @aswingiri
is there an UM function that can achieve it?Hello @aswingiri
I have already tried this function, it’s useful to show a restricted message to users who aren’t allowed to see the actual content.What I need is to show, on a category page, to every user (regardless of whether the user is restricted or not) if an article is restricted or not, before eventually clicking to open it.
If any user is on a category page, he has to know, for every article listed, if that is a “restricted” kind of article or not, before opening it.
Example:
Article 1 listed in a category page (set as restricted to logged in users)
Article 2 listed in a category page (not set as restricted)Every user who is on the category page has to read:
Article 1: “Premium content”
Article 2: “Free content”I think it’s obtainable by checking if the post has the “restricted access” option enable or not.
Forum: Developing with WordPress
In reply to: Update post_content on backend custom post openingI was only missing
$post->post_content .= $customContent;, saving the post was not enough indeed.
Thank you so much!
In the meanwhile, I was testing the “content_edit_pre” filter. This filter seems to work fine too, can you tell me if it’s an equally valid option or if it has any downside compared with “edit_form_top” action?Forum: Developing with WordPress
In reply to: Update post_content on backend custom post openingThis is my sample code, if you confirm that there isn’t any flaw inside of it then it can possibly be a theme or plugin interference.
I erased the empty post_content condition check but the content is still only showing after a second post opening.add_action( 'edit_form_top' , 'update_preset'); function update_preset() { global $post; $ID_post = $post->ID; if($post->post_type == "match" && $post->post_status == "future"){ $customContent = "some modified content"; $my_post = array( 'ID' => $ID_post, 'post_content' => $customContent,); wp_update_post( $my_post ); } }Forum: Developing with WordPress
In reply to: Update post_content on backend custom post openingThank you, it is working but I can only see the modified post content only after the second time that I open a post.
It seems that the content is updated on the first opening but it’s not instantly visible inside the editor.
So, at the very first time that I open a post, it still shows empty content but I need it to already be there.
How can I achieve it?