How to *disable* the post content editor

I think the best way is remove it and then print the content out of any textarea, but just as html: add_action(‘load-post.php’, ‘read_only_content’); function read_only_content() { if ( ! current_user_can(‘manage_options’) ) { // change the cap with the wanted one $scr = get_current_screen(); remove_post_type_support( $scr->post_type, ‘editor’ ); add_action(‘edit_form_after_editor’, ‘print_the_content’); } } function print_the_content( $post ) … Read more

Get IDs of posts currently visible on archive

When the wp_enqueue_scripts action fires, the main query has already run and the posts are in the global $wp_query. We just need to grab the ID from each object in $wp_query->posts, the wp_list_pluck function makes that easy: function wpd_get_post_ids(){ if( is_archive() ){ global $wp_query; $post_ids = wp_list_pluck( $wp_query->posts, ‘ID’ ); // $post_ids now contains an … Read more

Search and replace in post content

Okay, this always seems to happen to me. I spend ages looking for an answer and finally decide to give up and post here and then one more search finds enough to solve it. Anyway, this is what worked for me: update wp_posts set post_content = replace(post_content, ‘[/tab] [tab title=”1024×576″] <table class=”screenshot-table”>’, ‘[tabby title=”1024 x … Read more

How to display content from post_parent

As stated by the other answer, you can not pass an ID to get_the_content() function. You could fetch the post using get_post(), but there’s also another handy function that you can use to fetch the content: The get_post_field( $field, $post_id, $context ) function is what you’re looking for: $content = apply_filters( ‘the_content’, get_post_field( ‘post_content’, $post->ID … Read more

Format content value from DB outside of WordPress filters

There are a few filters and actions here that run. You’d need to look at the code and figure out what/how to utilize these. https://codex.wordpress.org/Function_Reference/wpautop https://codex.wordpress.org/Function_Reference/wptexturize https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content https://developer.wordpress.org/reference/functions/do_shortcode/ https://developer.wordpress.org/reference/functions/unescape_invalid_shortcodes/ https://developer.wordpress.org/reference/functions/get_shortcode_regex/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)