I’ve got a few different files of code so that might get a little complex.
What I’m thinking is that it’s because I’m effectively creating two psts at once, my own custom post type and your gallery post. It might be as simple as moving when I load the mpp actions file, let me check.
Hi George,
In your code, It seems to me you are using update_post_meta with gallery id.You are correct that you should not add custom fields for the post types which were not specific to your own implementation.
Regards
BrajeshHi George,
Please try changing this lineif ( $typenow == 'buslsite' ) {
to
if ( get_post_type( $post_id ) == 'buslsite' ) {
That should do it.
Congratulations.
Please do link me when you push the code 🙂About the code:-
$typenow is fine but it tell you more or less about the editing screen and not exactly about the post type being saved.In our case, we were saving 2 entries(1 for custom post and another for gallery post type). For both, the $typenow remained same as the second post(gallery) creation was triggered programatically. Using get_post_type( $post_id) gave us the current post being saved’s post type.
Hope that clarifies.
Regards
Brajesh
The topic ‘ [Resolved] Adding a gallery automatically on post creation’ is closed to new replies.