Post to WordPress from another Server via PHP

I finally managed to accomplish the task using XML-RPC as suggested by denis.stoyanov. If xmlrpc is installed on your Server simply use the wpPostXMLRPC function from stackoverflow. But keep in mind that the used xmlrpc_encode_request() is an experimental function you usually would try to avoid.

Get total post from an author

the_author_posts() doesn’t accept any parameters see the following codex page for more info: https://codex.wordpress.org/Function_Reference/the_author_posts#Parameters * UPDATED * Someone else had posted a VERY similar question. This should solve your problem: Show author post count in sidebar – Variable

Split post title for styling

Will the format always be as you described? I.e. can we use ‘x’ as a delimiter to split your title? If so something like this would work: add_filter( ‘the_title’, ‘wp123_custom_title_format’, 10, 2 ); function wp123_custom_title_format( $title ) { // if you only want to modify certain posts you can do a check here // use … Read more

WP_Query() load selected post

You don’t need a query if you the know the post ID: <?php $post_id = absint( $_POST[‘post_id’] ); if ( ! $post = get_post( $post_id ) ) exit; // Error if ( $post->post_status !== ‘publish’ ) exit; // Might want to prevent script kiddies from accessing private content echo ‘<h4>’ . get_the_title( $post ) . … Read more

Conflict array_splice on loop and query in widget

Your code is quite messy which makes debugging hard, so I cleaned up your code a bit. The posts_results filter accepts two parameters, one being the posts results array, and the second one is the current WP_Query instance. So you can pass the second argument and then test for your conditions. I haven’t tested your … Read more

Auto update post title and slug when post status is changed

I think I found the solution: add_filter(‘wp_insert_post_data’,’reset_post_date’,99,2); function reset_post_date($data,$postarr) { //update post time on status change $data[‘post_date’] = $data[‘post_modified’]; $data[‘post_date_gmt’] = $data[‘post_modified_gmt’]; //also update title and add the current date to title $data[‘post_title’] = ‘Your Default Title – ‘. current_time ( ‘m-d-Y’ ); //also update the slug of the post for the URL $data[‘post_name’] = … Read more

Add “Posted on” to post date

The post date is added by twentyfourteen_posted_on as shown in content.php. This function is in /inc/template-tags.php and is correctly wrapped in an if ( ! function_exists( ‘twentyfourteen_posted_on’ ) ) conditional so you can declare the same function in your child theme and modify it to your heart’s content. As such you could add a function … Read more

add div after image in post [closed]

Your question is a little light on detail of what you want to happen precisely. In general anything in WordPress content is usually treated as such. It’s not very friendly to being mixed with code, although many solutions try (often with poor results). The basic approach would be to use the_content filter to process post … Read more

Restore woocommerce orders

It’s Simple. Step 1: Create a replica of the instance. Step 2: Import the old .sql file which contained one day lost orders data. Step 3: Use https://wordpress.org/plugins/woocommerce-simply-order-export/ plugin and export CSV or XML of 1 day data which you have lost. Step 4: Install the above plugin in the LIVE instance and import the … Read more