It might seem counter intuitive to remove from the WordPress dashboard the menu items that allow a user to create posts.
Or crazy.
But follow my weaving here. This all started when Dave Cormier picked up my call to try a SPLOT. Well, I actually whinged
Dave wasted little time! But in no time quick was messaging Bad News.
That’s one I’ve not seen before. So I went over to one of my WordPress mutisites, made a new blog, set the theme to Baskerville, installed the plugin, and hey it all just worked.
Now I know the worst thing you can do when try to help someone with a technical issue is say, “it worked for me.” That does nothing (or less) for the recipient. So Dave DM-ed me a login, I checked our his site, made a few settings since I am so familiar with the theme. I made a quick post via the Writer functionality. I still cannot get a white screen of death.
He messaged that it was still happening.
Argh.
Then it became clear. He was not quite familiar with how the SPLOT worked, and he was trying to create something new, the regular way one does in WordPress, by making a new post in the dashboard.
That’s not how it’s done! For the content creation SPLOTs, it’s all done from the front end form. Not the back!
I actually had never even done that in one of my SPLOTs. But here is the value of having someone unfamiliar with your work take it for a spin (and crash in the corner).
But it’s a realistic error.
So I dug into stack exchange searches and found some three simple code chunks to add to the themes.
This first one removes the left side sub menu New Post (or Writing) item from the Posts menu (my code cleverly changes Posts
to Writings
but they are really just posts under the hood).
add_action( 'admin_menu', 'truwriter_remove_admin_submenus', 999 ); function truwriter_remove_admin_submenus() { remove_submenu_page( 'edit.php', 'post-new.php' ); }
Next, I want to remove Writing (aka Post) from the dropdown + New in the admin bar. Again, a short chunk of code.
add_action( 'admin_bar_menu', 'truwriter_remove_admin_menus', 999 ); function truwriter_remove_admin_menus() { global $wp_admin_bar; $wp_admin_bar->remove_node( 'new-post' ); }
Now one more. When you go to the main listing of Posts (aka Writings) there is a big Add Writing button next to the header. I could not find a way to remove it in code, so I reach for the CSS hammer, and find the proper selectors to make it disappear. This goes into a new CSS file admin.css
I created inside the theme’s include
directory.
.wp-admin.post-type-post a.page-title-action { display: none; }
Now I just need some code that will enqueue the special style sheet when the dashboard is loaded:
add_action('admin_enqueue_scripts', 'truwriter_custom_admin_styles'); function truwriter_custom_admin_styles(){ wp_enqueue_style( 'admin_css', get_stylesheet_directory_uri() . '/includes/admin.css'); }
And poof! Like that, there is no way to generate the SPLOT content except from the front end, where it gets all the special goodies it needs.
I was quickly able to add this as well to TRU Collector and SPLOTbox.
And now, NO NEW POST FOR YOU! (blog post title inspired by Seinfeld).
Featured Image: Created with imgflip meme generator the rights to which remain rather murky.
It also makes me think of SNL “Olympia Restaurant” sketch. Everyone walks up asking for something they want to eat, but all they serve is Cheeseburger, Chips and Pepsi.
No Post, just SPLOT.
https://youtu.be/puJePACBoIo
“Can I have a web site that automatically makes my students write good essays?”
“SPLOTburger, SPLOTburger. SPLOTburger”…
I can’t do a worthy Belushi
PS video unavailable in Canada. WTF with that?