Disable title block on edit screen for a custom post type

I have a custom post type with a custom block to collect required data and store it in post meta data or standard fields like title or slug, so I don’t want to display the Title block. I can’t disable title support in the CPT, because too much else depends on it.

The only successful attempt so far has been using CSS to target the id "post-title-0" of the for the title and can clearly enqueue a small CSS file depending on the post type, but I don’t want to depend on something set by WordPress that I can’t control; it feels that something in Javascript would be a better way to go if possible. I was wondering if WP provde any hooks for this but haven’t found any.

I’m a javascript novice, having started learning it in the last few weeks in order to write some custom blocks, so am not clear on the extent of what can be acheived with it. (I have 50 years experience of programming, just not in JS).

It would be OK to only hide the title until the post has been saved.

Has anyone any ideas?

Posting to a Custom Post Type from front end – user generated content

Is there a fast and reliable way of posting to a Custom Post type from the front end? My use case is for creating a daily checkin for a fitness trainer. I have created the necessary fields using ACF. And I was trying to create a front end post form using ACF Frontend for Elementor plugin. But in the plugin my post type doesnt show up at all. All in all I’ve tried various methods and I help with something concrete and reliable.

Thanks in advance!

sanitize_post() is not sanitizing Post Object

I wanted to sanitize a WP_Query post object without using foreach.

I used this method:

$  args = array( // ... ) $  data = array();  $  the_query = new WP_Query($  args);  $  data["post"] = $  the_query->posts;  array_map("sanitize_post", $  data["post"]);  return rest_ensure_response($  data); 

output:

enter image description here

as you can see that filter is working and its turning to "Display" from "Raw".

But the problem is: <script> tags still standing in post_title field.

Whats the problem?

Not able to open category post

my website home page working perfectly fine all links are clickable and opening, but when I open any menu or category page I’m not able to click and open the post. However, If I right-click and open the post in a new tab or window, it is opening perfectly fine. If I open customize preview mode then also all links are working fine. Does anyone know what is the issue here and how can I fix it?

The page I need help with: https://cominggames.com/category/best-and-worst/

Use the backbone.js client to save custom post type meta

So I have this small piece of code that renders an array of IDs:

const selected = this.$  data.list.selected; function get_ids(input, field) {     const output = [];     for (let i=0; i < input.length ; ++i)         output.push(input[i][field]);     return output; } const result = get_ids(selected, "id"); 

Now inside my JS, I want to be able to use the backbone.js API that WordPress provides to save it to my employee custom post type as a post meta.

So let’s say that my result output is [343, 3532] – I want to be able to save that array as a "apps" post meta under employees.

I know examples showed that it would be something like const test = new wp.api.models.Employee().fetch and then save, but it sounds super confusing since I don’t have a specific post, and would just like to save the post meta.

Based on these examples, does anyone know how I could do that? https://developer.wordpress.org/rest-api/using-the-rest-api/backbone-javascript-client/#model-examples

Post Images URL in Bootstrap Carousel

So i made a blog with some posts, that contain a few images that i want to show in a carousel using Bootstrap. Right now, my code gets all the images and their URL’s and i want to use those URL’s in the image sources. The problem now is that the images do show, but half on top of eachother. I think the problem is in html in the foreach because they both have the "active" tag

Anybody has a better way to show these images in a carousel? Let me know

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">                                          <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">                       <ol class="carousel-indicators">                         <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>                         <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>                         <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>                       </ol>                       <div class="carousel-inner">                           <?php                                                                                    $  attachments = get_attached_media('image', get_the_ID());                             foreach ($  attachments as $  image) {                                 $  full_img_url = wp_get_attachment_url($  attachment->ID);                                 ?>                                 <div class="carousel-item active">                                   <img class="d-block w-100" src="<?php echo wp_get_attachment_url($  image->ID); ?>" alt="First slide">                                 </div>                           <?php                                                        }                           ?>                                                <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">                         <span class="carousel-control-prev-icon" aria-hidden="true"></span>                         <span class="sr-only">Previous</span>                       </a>                       <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">                         <span class="carousel-control-next-icon" aria-hidden="true"></span>                         <span class="sr-only">Next</span>                       </a>                     </div> 

Blog Post Spams

Everyday I get between 30 to 40 spam replies on my blog post.

My setting does not allow the replies to be published unless I agree.

Is there away to stop getting so many spams or should I just not allow any post replies?

Proceed to the next video of the custom post type but remain on the same post

So I have a custom post type in WordPress that displays html5 videos. Is there a way I could automatically play the next video once it’s over and still remain on the same post? I’m thinking something like this would be the perfect example.

Here’s a link to what I have so far.

I have a custom post type called nowthisearth_post and a custom field nowthisearth_media_url that is pulling in the link to the MP4 file. Right now there are 6 posts and would like for it to proceed to the next one after the video ends. Here’s what I have right now..

I started off using the get_next_post(); function but it doesn’t seem to work. I’m thinking maybe it would need to be converted into some sort of video playlist with thumbnails at the bottom.

<div class="container-fluid nowthis-header"> <div class="container" style="z-index:11;">     <div class="row">         <div class="col-12">             <?php $  mrssfeed_url = get_post_meta(get_the_id(), 'nowthisearth_media_url', true);?>             <video class="nowthis-video" style="" width="1280" height="720" autoplay="true" controls loop>               <source src="<?php echo $  mrssfeed_url ?>" type="video/mp4">                 Your browser does not support the video tag.             </video>         </div>         <div class="col-12">             <?php $  next_post = get_next_post();             if ( is_a( $  next_post , 'nowthisearth_post' ) ) : ?>                 <a href="<?php echo get_permalink( $  next_post->ID ); ?>"><?php echo get_the_title( $  next_post->ID ); ?></a>             <?php endif; ?>         </div>     </div> </div> 

Display page and custom post title inside shortcode

I trying to write shortcode to display page title but only got the archive title to work but not custom post type category and single post. Can anyone shed light how to do this? Reason for going this path is Elemenentor theme builder generate too much code for simple page title and subheading inside secondary header that is masked wrap around image. I use the shortcode widget to insert the code and style it.

So far this is what I have written:

// Page Title inside shortcode function page_title_sc( ) {     $  title = ('Page Title');     if ( is_post_type_archive() ) {     $  title = post_type_archive_title( '', false );   }   elseif ( is_page() ) {     $  title = single_post_title();    }     return apply_filters( 'page_title_sc', $  title ); }   add_shortcode( 'page_title', 'page_title_sc' );