publish_post plugin hook doesn’t always pass $post->post_content

I’ve written a simple plugin that grabs the contents of a post, as the post is published, and sends them to an external site for archiving. This generally works but when dealing with posts that haven’t previously been saved or published, no post_content value is available. If you save as draft before publishing it all … Read more

add_action on inherit post status

I’m trying to use the add_action() hook to run a custom function, but am struggling with the post status. I originally tried using: add_action(‘pending_to_publish_portfolio’, ‘my_function’); (portfolio being my custom post type). This didn’t work, so i posted in the official WordPress Support forum for some help. I was given the following code to get the … Read more

Placement of Code in Plugin for hooking `save_post`

I ran into a strange Problem today developing a new Plugin. I set it up as usual, creating the f711-roomprice folder in the Plugindirectory, and creating the f711-roomprice.php as well as an inc directory in there. Everything worked fine with the activation hook and the included functions, until i created an include: include(‘inc/filter-savepost.php’); this file … Read more

Gravity Forms field entries into wp_query loop [closed]

Closed. This question is off-topic. It is not currently accepting answers. Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic. Closed 7 years ago. Improve this question I have a … Read more

Custom Blog Post Listing in Genesis Sample Child Theme

I want to add several images and divs and also customize the look of my Blog post listing… But i can’t find the way to do it. Here’s the Blog Template code <?php /* WARNING: This file is part of the core Genesis framework. DO NOT edit this file under any circumstances. Please do all … Read more

How to set a custom path, for ajax image upload folder in admin?

I am coding my first WordPress plugin that handles some data for a custom (shop-like) post type. It also has an image uploader within a metabox, where you simply drag in your images and it automatically handles the uploads, filename and media-library integration without reloading the page. (AJAX) To do this I use Javascript for … Read more

How to add rewrite rules and pagination to retrieve attachments files?

I’m trying to list attachments based on different taxonomies. Right now it only work for the basic url (no pagination added). For example http://www.example.com/exams/high-school/city-name/subject/math/ First, I added my custom rewrite rule in functions.php as follows: function add_rewrite_rules($aRules) { $new_rules = array( // rule 1 ‘exams/([^/]+)/([^/]+)/subject/([^/]+)/?$’ => ‘index.php?pagename=exams&level=$matches[1]&city=$matches[2]&subject=$matches[3]’, // rule 2 ‘exams/([^/]+)/([^/]+)/subject/([^/]+)/page/([0-9]+)/?$’ => ‘index.php?pagename=exams&level=$matches[1]&city=$matches[2]&subject=$matches[3]&page=$matches[4]’ ); return … Read more