Disable external (3rd party) CALL (images,fonts..) in Dashboard

There’s no such constant in WordPress core that would allow you to that. As plugins and themes can do pretty much anything, it’s hard to detect such external calls. Also, only very few users actually run WordPress on a local install (mainly developers). Thus, this is not suitable for core according to the project’s philosophies … Read more

How to make search and replace in content through php

From the documentation of WP All Import, the pmxi_saved_post action takes one parameter, $id, which is “the ID of the post/page/Custom Post Type that was just created.” So, your post_saved() callback should look like this: add_action(‘pmxi_saved_post’, ‘wpse246838_post_saved’, 10, 1); function wpse246838_post_saved( $id ) { $my_post = array( “ID” => $id, “post_content” => “1”, ); wp_update_post( … Read more

Reusable content block

if you’re using ACF, create an options page and then add a field there. Then present that data in a side widget by echoing out the field. once the field is created you can call it with this code: <?php the_field(‘page_content’, ‘option’); ?> I like to add it to a function function rt_show_field() { $field … Read more

Conflicting post edit options under dashboard

Columns can be hidden from view using the screen options tab. On the upper right hand side of the dashboard click screen options Un check any of the columns you want to hide. Normally the edit options are displayed as horizontal text. A plugin or other function has changed this.

content gets scrambled

This is because the images are defined as floating to the left. To solve this, you can add a clear: both to the <h4> elements (it probably won’t hurt to do this in the stylesheet – will there be a situation where you need a title that exists next to a float?).

Get the Page Content,without generating HTML

Where are you doing your code parsing? If you’re doing it directly in the template file, inside the Loop, then you should be using get_the_content(). However, it might be more efficient to filter the_content(), via the the_content filter. e.g. in functions.php: function mytheme_filter_the_content( $content ) { // add code here to filter the_content // which … Read more

Better way to remove HTML syntax from all content

If you just need to change the post content, you can avoid the overhead of get_posts/WP_Query by directly querying the database: global $wpdb; $results = $wpdb->get_results(“SELECT ID, post_content FROM {$wpdb->posts}”); $total = count($results); $changed = 0; foreach($results as $entry){ $new_content = strip_tags($entry->post_content, ‘<img><a>’); if($entry->post_content !== $new_content){ $wpdb->query($wpdb->prepare( “UPDATE {$wpdb->posts} SET post_content = %s WHERE ID … Read more