Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:36:23+00:00 2026-06-03T07:36:23+00:00

I am trying to run the following function anytime a wordpress Jobs custom post

  • 0

I am trying to run the following function anytime a wordpress “Jobs” custom post is published. The code works (lines 2-7) when it is placed in my theme template, but it only runs when the post is viewed. I want the code to run when the post is published, and so I have tried adding the code in a function inside my functions.php, but nothing is happening when each custom post is published. Any suggestions?

function indeedgeo(){
    $indeedgeo = get_post_meta($post>ID, indeedgeo, true);
    $indeedgeos=explode(' ',$indeedgeo);
    $_jr_geo_latitude = $indeedgeos[0];
    $_jr_geo_longitude = $indeedgeos[1];
    update_post_meta($post->ID, _jr_geo_latitude, $_jr_geo_latitude);
    update_post_meta($post->ID, _jr_geo_longitude, $_jr_geo_longitude);
    }
add_action('publish_Jobs', 'indeedgeo');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:36:24+00:00Added an answer on June 3, 2026 at 7:36 am

    You should hook into one of the three actions;

    do_action('edit_post', $post_id, $post);
    do_action('save_post', $post_id, $post);
    do_action('wp_insert_post', $post_id, $post);
    

    that are run when a post is either saved, or has its status updated. Something like the following should do the trick.

    function se_10441543_save_post($post_id, $post){
        //determine post type
        if(get_post_type( $post_id ) == 'your_post_type'){
            //run your code
            $indeedgeo = get_post_meta($post_id, indeedgeo, true);
            $indeedgeos=explode(' ',$indeedgeo);
            $_jr_geo_latitude = $indeedgeos[0];
            $_jr_geo_longitude = $indeedgeos[1];
            update_post_meta($post_id, _jr_geo_latitude, $_jr_geo_latitude);
            update_post_meta($post_id, _jr_geo_longitude, $_jr_geo_longitude);
        }
    }
    
    add_action('save_post', 'se_10441543_save_post', 10, 2);
    

    http://codex.wordpress.org/Plugin_API/Action_Reference

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run following code: $a = array('aa'); function my_func (& $m)
when I trying to run following code. var result = from c in db.brand
I'm learning about Qt Model/View with Ruby and I'm trying run the following code
I am trying to run the following code from within Eclipse: Process process =
I am trying to run the following code, taken from the Facebook developer site.
So I'm learning jQuery Mobile and I'm trying to run the following code below
I'm trying to run the following code on a website to set up the
I'm trying to run the following code, written on my local machine: http://www.jsfiddle.net/WShdx/3/ Functionality-wise
I am trying to run the following C function from Java using JNA, but
I am trying to get the following function to run when the link is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.