• I am building a website based on WP MU (subdomain network) for data and information selling purpose. Some plugins are installed and now I need to solve the problem on how to create a custom filed that will auto populate itself with some complex value all together with some special rules.

    I have 2 post typs: Orders and Administration.
    Both post typs have purchase_order custom field.

    This is the sample of purchase order record:

    POCOS20130051

    PO – is prefix that is always the same
    CO – first 2 letters of the site name – if site name is cocacola – CO will appear (if I change the name of the site, this will change too)
    S – always the same
    2013 – current year
    0051 – number that increase by 1 when hit Add New Order. Must have 4 characters. If number is 1 then 0001 will appear.

    Now… If client what to submit order and he click on Add New Order link, purchase_order custom filed must be populated with next free PO number.
    In this case: POCOS20130052.

    But… if seller want to create new Administration Page and when he click on Add New Administration link, purchase_order custom filed has to be auto populated with next free number (POCOS20130053), even if client didn’t publish his order (POCOS20130052).

    I am using Advanced Custom Fields and Custom Post Type Maker plugins and my PHP knowledge is not so brilliant, so I am asking you to help me, if you find this interesting.

    Thanks in advance.

  • The topic ‘How to Auto Populate Custom Field with Complex Value That Increase by One?’ is closed to new replies.