apply_filters(‘the_content’) – make it ignore shortcodes?

The function that parses the shortcode, do_shortcode is added as a filter on the_content by default, at priority 11. You can remove it using remove_filter: remove_filter( ‘the_content’, ‘do_shortcode’, 11 ); Call this right before you’re actually using the_content, and add it afterwards (in the unlikely case that it’s needed after that): remove_filter( ‘the_content’, ‘do_shortcode’, 11 … Read more

Set post title based on first h2 element in the content section

If you can handle this in the PHP side, you might be able to pull the h2 tags from the content using regular expression. PHP VERSION Test content $content = “<h2>This is H2 Content</h2><p>This is p content</p>Random Content<h2>This is another H2 section</h2><b><h2>This the third H2 section</h2></b>”; Grab any text inside H2s preg_match_all(‘#<h2>(.*?)</h2>#’, $content, $matches); // … Read more

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