Update Custom Field on Imported Post Creation

There is a hook that worked for me in most case while those 3 hooks you use fail. It’s transition_post_status : add_action(‘transition_post_status’, ‘sterilize_vehicle_information’, 10, 3); function sterilize_vehicle_information( $post, $new_status, $old_status) { $internet_price = get_field(‘internet_price’,$post->ID); if( $new_status == ‘publish’ && old_status != ‘publish’ ) { update_post_meta( $post->ID, ‘internet_price’, preg_replace( “/[^0-9]/”, “”, $internet_price ) ); } } … Read more

Post from one loop in different containers?

<?php $class=””; // set your class to nothing outside the loop ?> <?php if (have_posts()) : while ( have_posts()) : the_post(); ?> <?php $class = (‘first-container’ == $class) ? ‘second-container’ : ‘first-container’; // alternate classes ?> <div <?php post_class(‘clearfix’) ?> id=”post-<?php the_ID(); ?>”> <h2><a href=”https://wordpress.stackexchange.com/questions/77704/<?php the_permalink() ?>”><?php the_title(); ?></a></h2> <div class=”<?php echo $class ?>”> If … Read more

Twitter feed is showing blank in WP site [closed]

It is very likely because you are using the old Twitter API, for example: <script type=”text/javascript” src=”http://twitter.com/statuses/user_timeline/USERNAME.json?callback=twitterCallback2&amp;count=4″> You will need to update your code to the new API: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=USERNAME&include_rts=true&count=4&callback=twitterCallback2 This requires that you edit the code of the theme. Many themes suffered this issue for a few months ago when Twitter made their changes.

WordPress theme & site not loading after moving files

If you cannot login, use FTP or the file manager to edit wp-config.php and define WP_HOME and WP_SITEURL,. define( ‘WP_SITEURL’, ‘http://www.security-shell.com ‘); define( ‘WP_HOME’, ‘http://www.security-shell.com ‘ ); When you moved files to that subfolder, you probably copied and edited the main index.php file. Make sure that that process gets reversed. That should get things working … Read more

post meta value as shortcode parameter

// hijack the download shortcode add_shortcode( ‘dlm_gf_form’, array( $this, ‘shortcode_dlm_gf_form’ ) ); This line just adds a shortcode from a class. I checked this plugin’s class and they didn’t provide any actions or filter. You can try to modify original code of this plugin for your purposes only. I don’t see any other solution. I … Read more

how to add display_name from the users table to this query

You should be able to do something like this, by adding in another join, and selecting the display_name column from that joined table: SELECT a.post_title, b.meta_key, b.meta_value as level, c.meta_value as intro, u.display_name FROM wp_posts a LEFT JOIN wp_postmeta b ON a.ID = b.post_id LEFT JOIN wp_postmeta c ON a.ID = c.post_id LEFT JOIN wp_users … Read more

How to Remove a Filter from the Admin List Table?

I can see that it’s implemented inside the class WC_Admin_List_Table_Orders which extends WC_Admin_List_Table. Yes, that’s correct. And the orders list table is setup via WC_Admin_Post_Types::setup_screen() where the method is called via these hooks: (see WC_Admin_Post_Types::__construct()) // Load correct list table classes for current screen. add_action( ‘current_screen’, array( $this, ‘setup_screen’ ) ); add_action( ‘check_ajax_referer’, array( $this, … Read more